A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/5963 below:

Unable to compare timedelta64 to timedelta · Issue #5963 · pandas-dev/pandas · GitHub

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4