-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
np.ndarray[object] - Timedelta raises #21980
Comments
I suppose this is because of pandas/pandas/_libs/tslibs/timedeltas.pyx Lines 539 to 544 in 27ebb3e
Any idea what the "wrong" answer would be? (with timedelta.timedelta instead of Timedelta that seems to work just fine, so I assume with Timedelta it will be the same) |
No idea what the wrong answer would be. This should be easy to fix; if no one else picks it up I'll take care of it once the current PR queue settles down. |
Yes, PR with a fix is certainly welcome I think |
Is this still an issue? I wasn't able to repro from master. |
What platform etc? I still get it on OSX in both py27 and py37. |
OSX 10.11.6 with Python 3.6. I just pulled up a REPL and imported pandas from a compile I did yesterday from master and didn't get an exception from the example code posted. Specifically |
I also didn't see the issue from the latest install from pip either. Both times I just got >>> arr = np.array([pd.Timestamp.now(), pd.Timedelta('2D')])
>>> arr
array([Timestamp('2018-07-24 10:49:41.898067'),
Timedelta('2 days 00:00:00')], dtype=object) |
Did you try subtracting a |
Ah! 🤦♂️ yea I missed that part in the example. I repro'd the bug with that on master and latest pip. So with this then how should I go about the fix? It's not operating element wise on the array because the timedeltas.pyx isn't returning that it is a timedelta correctly? or...? |
Take a look at the code block Joris quoted above. At the moment that lets 'm' and 'M' dtypes through but stops everything else. The fix will involve letting 'o' dtypes through (and making sure they are handled correctly) |
includes *.pyx, *.pyi, *.pyi.in, *.pyd refs pandas-dev#21980
includes *.pyx, *.pyi, *.pyi.in, *.pyd refs pandas-dev#21980
includes *.pyx, *.pyi, *.pyi.in, *.pyd refs pandas-dev#21980
It should attempt to operate element-wise.
The text was updated successfully, but these errors were encountered: