Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug resampling quarterly period data to annual #1622

wesm opened this issue Jul 14, 2012 · 0 comments


None yet
1 participant
Copy link

commented Jul 14, 2012

In [10]: rng = period_range('2000Q1', periods=10, freq='Q-DEC')

In [11]: rng
<class 'pandas.tseries.period.PeriodIndex'>
freq: Q-DEC
[2000Q1, ..., 2002Q2]
length: 10

In [12]: ts = Series(np.arange(10), index=rng)

In [13]: ts
2000Q1    0
2000Q2    1
2000Q3    2
2000Q4    3
2001Q1    4
2001Q2    5
2001Q3    6
2001Q4    7
2002Q1    8
2002Q2    9
Freq: Q-DEC

In [14]: ts.resample('A')
ValueError                                Traceback (most recent call last)
/home/wesm/Dropbox/talks/scipy2012/tutorial/<ipython-input-14-d20eb06885e9> in <module>()
----> 1 ts.resample('A')

/home/wesm/code/pandas/pandas/core/generic.pyc in resample(self, rule, how, axis, fill_method, closed, label, convention, kind, loffset, limit, base)
    187                               fill_method=fill_method, convention=convention,
    188                               limit=limit, base=base)
--> 189         return sampler.resample(self)
    191     def first(self, offset):

/home/wesm/code/pandas/pandas/tseries/resample.pyc in resample(self, obj)
     73             if self.kind is None or self.kind == 'period':
---> 74                 return self._resample_periods(obj)
     75             else:
     76                 obj = obj.to_timestamp(how=self.convention)

/home/wesm/code/pandas/pandas/tseries/resample.pyc in _resample_periods(self, obj)
    233         else:
    234             raise ValueError('Frequency %s cannot be resampled to %s'
--> 235                              % (axlabels.freq, self.freq))

ValueError: Frequency Q-DEC cannot be resampled to <1 YearEnd: kwds={'month': 12}, month=12>

@wesm wesm closed this in 8cc9826 Jul 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.