Closed
Description
In [426]:
s = pd.Series([timedelta(days=1), timedelta(days=2)])
s > timedelta(days=1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-426-9094b7c93677> in <module>()
1 s = pd.Series([timedelta(days=1), timedelta(days=2)])
----> 2 s > timedelta(days=1)
/usr/local/lib/python2.7/dist-packages/pandas-0.13.0rc1_78_g142ca62-py2.7-linux-x86_64.egg/pandas/core/ops.pyc in wrapper(self, other)
561
562 # scalars
--> 563 res = na_op(values, other)
564 if np.isscalar(res):
565 raise TypeError('Could not compare %s type with Series'
/usr/local/lib/python2.7/dist-packages/pandas-0.13.0rc1_78_g142ca62-py2.7-linux-x86_64.egg/pandas/core/ops.pyc in na_op(x, y)
528
529 try:
--> 530 result = getattr(x, name)(y)
531 if result is NotImplemented:
532 raise TypeError("invalid type comparison")
TypeError: can't compare datetime.timedelta to long
The comparison does work for timedelta64
:
In [45]: s > np.timedelta64(timedelta(days=1))
Out[45]:
0 False
1 True
dtype: bool