ERR: Maximum recursion depth exceeded in comparision when comparing a TimeDelta to numpy object array of TimeDelta · Issue #11835 · pandas-dev/pandas (original) (raw)

See http://stackoverflow.com/questions/34251068/runtimeerror-from-scipy-stats-mode-on-array-of-timedelta-maximum-recursion-dept

Python 3.5.1, pandas 0.17.1, numpy 0.10.1:

Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import numpy as np

In [2]: np.__version__
Out[2]: '1.10.1'

In [3]: import pandas as pd

In [4]: pd.__version__
Out[4]: '0.17.1'

Create a numpy array of TimeDelta objects, and do a comparison of the array to a TimeDelta instance:

In [5]: from pandas import Timedelta

In [6]: periods = [Timedelta('0 days 01:00:00'), Timedelta('0 days 01:00:00')]

In [7]: p = np.array(periods)

In [8]: periods[0] > p
---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-8-1c05a376ecc2> in <module>()
----> 1 periods[0] > p

pandas/tslib.pyx in pandas.tslib._Timedelta.__richcmp__ (pandas/tslib.c:38155)()

<SNIP>

pandas/tslib.pyx in pandas.tslib._Timedelta.__richcmp__ (pandas/tslib.c:38155)()

pandas/tslib.pyx in pandas.tslib._Timedelta.__richcmp__ (pandas/tslib.c:38155)()

RecursionError: maximum recursion depth exceeded in comparison

In [9]: