Skip to content

Series.resample leads to RuntimeError: maximum recursion depth exceeded while calling a Python object #5026

@cancan101

Description

@cancan101
rng = pd.date_range('1/1/2012', periods=4, freq=pd.offsets.YearEnd())
s = pd.Series(np.random.randn(4), index=rng)
s.resample(rule=pd.offsets.Week(weekday=0), fill_method="pad", closed="left", kind="period")

leads to:

...
/usr/local/lib/python2.7/dist-packages/pandas/tseries/period.pyc in _from_arraylike(cls, data, freq, tz)
    652                                       'inferred from first element'))
    653 
--> 654                 if np.issubdtype(data.dtype, np.datetime64):
    655                     data = dt64arr_to_periodarr(data, freq, tz)
    656                 elif data.dtype == np.int64:

/usr/local/lib/python2.7/dist-packages/numpy/core/numerictypes.pyc in issubdtype(arg1, arg2)
    757 
    758     """
--> 759     if issubclass_(arg2, generic):
    760         return issubclass(dtype(arg1).type, arg2)
    761     mro = dtype(arg2).type.mro()

/usr/local/lib/python2.7/dist-packages/numpy/core/numerictypes.pyc in issubclass_(arg1, arg2)
    697     """
    698     try:
--> 699         return issubclass(arg1, arg2)
    700     except TypeError:
    701         return False

Setting kind="period" seems to trigger the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions