Skip to content
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

DataFrame.__eq__ wrong for datetime64 vs timedelta64 #18784

Closed
jbrockmendel opened this issue Dec 14, 2017 · 1 comment
Closed

DataFrame.__eq__ wrong for datetime64 vs timedelta64 #18784

jbrockmendel opened this issue Dec 14, 2017 · 1 comment
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type

Comments

@jbrockmendel
Copy link
Member

df = pd.DataFrame(pd.date_range('20130101', periods=3))
dt64 = np.datetime64('2013-01-01')
res = df - dt64
expected = pd.DataFrame([pd.Timedelta(days=0), pd.Timedelta(days=1),
                                              pd.Timedelta(days=2)])

>>> res
           0
0 1970-01-01
1 1970-01-02
2 1970-01-03

>>> expected
       0
0 0 days
1 1 days
2 2 days

>>> res == expected
      0
0  True
1  True
2  True

So both __sub__ and __eq__ are problematic.

@jreback
Copy link
Contributor

jreback commented Dec 15, 2017

this is a duplicate of #12437

@jreback jreback closed this as completed Dec 15, 2017
@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type Datetime Datetime data dtype labels Dec 15, 2017
@jreback jreback added this to the No action milestone Dec 15, 2017
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Dec 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

2 participants