We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Not sure if this is a bug or not.
import datetime In [24]: s = pd.Series(pd.to_datetime(['2015-01-01', '2015-02-02'])) In [25]: s Out[25]: 0 2015-01-01 1 2015-02-02 dtype: datetime64[ns] In [26]: s.diff() / datetime.timedelta(1) Out[26]: 0 NaN 1 32 dtype: float64 In [27]: s.diff().div(datetime.timedelta(1)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-27-1197779902ae> in <module>() ----> 1 s.diff().div(datetime.timedelta(1)) C:\Miniconda\lib\site-packages\pandas\core\ops.pyc in flex_wrapper(self, other, level, fill_value, axis) 716 level=level, fill_value=fill_value) 717 else: --> 718 return self._constructor(op(self.values, other), 719 self.index).__finalize__(self) 720 TypeError: ufunc true_divide cannot use operands with types dtype('<m8[ns]') and dtype('O')
Works with our Timedelta though, as suggested by the error message:
In [28]: s.diff().div(pd.Timedelta(1, unit='D')) Out[28]: 0 NaN 1 32 dtype: float64
It at least seems strange that / worked while .div didn't.
/
.div
This is the released 0.15.2, and python 2.
The text was updated successfully, but these errors were encountered:
you can mark this as a bug / enhancement timedelta generally need wrapping internally in TimeDelta in order to work
Sorry, something went wrong.
TST: Test timedelta arithmetic (pandas-dev#9396)
56c5ba3
TST: Test timedelta arithmetic (#9396) (#14906)
37b22c7
TST: Test timedelta arithmetic (pandas-dev#9396) (pandas-dev#14906)
0b2d31b
247b0c8
Successfully merging a pull request may close this issue.
Not sure if this is a bug or not.
Works with our Timedelta though, as suggested by the error message:
It at least seems strange that
/
worked while.div
didn't.This is the released 0.15.2, and python 2.
The text was updated successfully, but these errors were encountered: