{"action":"opened","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/12770","repository_url":"https://api.github.com/repos/pydata/pandas","labels_url":"https://api.github.com/repos/pydata/pandas/issues/12770/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/12770/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/12770/events","html_url":"https://github.com/pydata/pandas/issues/12770","id":145306541,"number":12770,"title":"BUG: Resample on existing freq causes recursion error","user":{"login":"MaximilianR","id":5635139,"avatar_url":"https://avatars.githubusercontent.com/u/5635139?v=3","gravatar_id":"","url":"https://api.github.com/users/MaximilianR","html_url":"https://github.com/MaximilianR","followers_url":"https://api.github.com/users/MaximilianR/followers","following_url":"https://api.github.com/users/MaximilianR/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianR/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianR/subscriptions","organizations_url":"https://api.github.com/users/MaximilianR/orgs","repos_url":"https://api.github.com/users/MaximilianR/repos","events_url":"https://api.github.com/users/MaximilianR/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianR/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-01T23:07:50Z","updated_at":"2016-04-01T23:07:50Z","closed_at":null,"body":"#### Code Sample, a copy-pastable example if possible\r\n```python\r\n\r\nIn [26]: series=pd.Series(range(10), pd.period_range(start='2000', periods=10, name='date', freq='M'))\r\n\r\nIn [25]: series\r\nOut[25]: \r\ndate\r\n2000-01    0\r\n2000-02    1\r\n2000-03    2\r\n2000-04    3\r\n2000-05    4\r\n2000-06    5\r\n2000-07    6\r\n2000-08    7\r\n2000-09    8\r\n2000-10    9\r\nFreq: M, dtype: int64\r\n\r\n\r\nIn [30]: series.resample('M').first()\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-30-4637af8f5d6f> in <module>()\r\n----> 1 series.resample('M').first()\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/resample.py in f(self, _method)\r\n    465 \r\n    466     def f(self, _method=method):\r\n--> 467         return self._downsample(_method)\r\n    468     f.__doc__ = getattr(GroupBy, method).__doc__\r\n    469     setattr(Resampler, method, f)\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/resample.py in _downsample(self, how, **kwargs)\r\n    709                          'resampled to {freq}'.format(\r\n    710                              axfreq=ax.freq,\r\n--> 711                              freq=self.freq))\r\n    712 \r\n    713     def _upsample(self, method, limit=None):\r\n\r\nValueError: Frequency <MonthEnd> cannot be resampled to <MonthEnd>\r\n\r\n# --> which is fair, even if I could imagine it returning itself\r\n\r\nIn [31]: series.resample('M').pad()\r\n\r\n---------------------------------------------------------------------------\r\nRecursionError                            Traceback (most recent call last)\r\n<ipython-input-24-9df8c7209780> in <module>()\r\n----> 1 series.resample('M').pad()\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/resample.py in pad(self, limit)\r\n    393         DataFrame.fillna\r\n    394         \"\"\"\r\n--> 395         return self._upsample('pad', limit=limit)\r\n    396     ffill = pad\r\n    397 \r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/resample.py in _upsample(self, method, limit)\r\n    736 \r\n    737         if not is_superperiod(ax.freq, self.freq):\r\n--> 738             return self.asfreq()\r\n    739 \r\n    740         # Start vs. end of period\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/resample.py in asfreq(self)\r\n    435         essentially a reindex with (no filling)\r\n    436         \"\"\"\r\n--> 437         return self._upsample(None)\r\n    438 \r\n    439     def std(self, ddof=1):\r\n\r\n# ...............\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/period.py in _generate_range(cls, start, end, periods, freq, fields)\r\n    200                 raise ValueError('Can either instantiate from fields '\r\n    201                                  'or endpoints, but not both')\r\n--> 202             subarr, freq = _get_ordinal_range(start, end, periods, freq)\r\n    203         elif field_count > 0:\r\n    204             subarr, freq = _range_from_fields(freq=freq, **fields)\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/tseries/period.py in _get_ordinal_range(start, end, periods, freq, mult)\r\n    995 \r\n    996     if start is not None:\r\n--> 997         start = Period(start, freq)\r\n    998     if end is not None:\r\n    999         end = Period(end, freq)\r\n\r\npandas/src/period.pyx in pandas._period.Period.__init__ (pandas/src/period.c:10867)()\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/_bootstrap.py in _find_and_load(name, import_)\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/_bootstrap.py in __enter__(self)\r\n\r\n/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/_bootstrap.py in _get_module_lock(name)\r\n\r\nRecursionError: maximum recursion depth exceeded\r\n```\r\n\r\n#### Expected Output\r\n\r\nRaise on the initial resample? Return itself? Deliberately raise on `pad`?\r\n\r\n#### output of ``pd.show_versions()``\r\n\r\n18.0"}}