Skip to content

Fix+test DTI/TDI/PI add/sub with ndarray[datetime64/timedelta64] #19847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 25, 2018

Conversation

jbrockmendel
Copy link
Member

Two notes for upcoming passes:

  • the tests are pretty redundant, can be parametrized more tightly once they are all OK.
  • catching ndarray[datetime64] separately from DatetimeIndex is kind of weird, but for the moment necesarry. Once De-duplicate add_offset_array methods #19835 goes through and re-orders the catching, we'll be able to fix this.

@gfyoung gfyoung added Testing pandas testing functions or related to the test suite Datetime Datetime data dtype labels Feb 23, 2018
@gfyoung
Copy link
Member

gfyoung commented Feb 23, 2018

@jbrockmendel : Good direction so far! Looks you can parametrize now since all the CI is green.

if is_datetime64_dtype(other) and is_timedelta64_dtype(self):
# ndarray[datetime64] cannot be subtracted from self, so
# we need to wrap in DatetimeIndex and flip the operation
from pandas.core.indexes.datetimes import DatetimeIndex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since inside a function, can just import from pandas directrly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atually pls change all imports that are inside functions to do this (its just shorter)

@codecov
Copy link

codecov bot commented Feb 23, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@e97be6f). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #19847   +/-   ##
=========================================
  Coverage          ?   91.69%           
=========================================
  Files             ?      150           
  Lines             ?    48920           
  Branches          ?        0           
=========================================
  Hits              ?    44857           
  Misses            ?     4063           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.07% <100%> (?)
#single 41.82% <8.33%> (?)
Impacted Files Coverage Δ
pandas/core/indexes/timedeltas.py 90.99% <100%> (ø)
pandas/core/indexes/datetimelike.py 97.38% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e97be6f...dc67762. Read the comment docs.

@jbrockmendel jbrockmendel mentioned this pull request Feb 23, 2018
15 tasks
@jreback
Copy link
Contributor

jreback commented Feb 24, 2018

needs a rebase. does this fix any open issue?

@jbrockmendel
Copy link
Member Author

does this fix any open issue?

Not that I'm aware of.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a whatsnew note to show what is a bug fix / enhancement / api change (IOW what works now that didn't work before)

# -------------------------------------------------------------
# __add__/__sub__ with ndarray[datetime64] and ndarray[timedelta64]

def test_dti_add_dt64_array_raises(self, tz):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests don't exist already? odd

@jbrockmendel
Copy link
Member Author

Here too Travis error is pyarrow import

@jreback jreback added this to the 0.23.0 milestone Feb 25, 2018
@jreback jreback merged commit 5a87765 into pandas-dev:master Feb 25, 2018
@jreback
Copy link
Contributor

jreback commented Feb 25, 2018

thanks

@jbrockmendel jbrockmendel deleted the dtlike4 branch June 22, 2018 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants