Skip to content

DOC: Anchored Offset Starting Quarter and Year defaults to JAN not DEC #17787

Open
@tdpetrou

Description

@tdpetrou

Code Sample, a copy-pastable example if possible

>>> index = pd.date_range('2012-1-1', '2013-12-31')
>>> np.random.seed(1)
>>> data = np.random.randint(0, 10, len(index))
>>> s = pd.Series(index=index, data=data)

>>> s.resample('Q').sum()
2012-03-31    457
2012-06-30    404
2012-09-30    401
2012-12-31    415
2013-03-31    383
2013-06-30    382
2013-09-30    398
2013-12-31    387
Freq: Q-DEC, dtype: int64

>>> s.resample('Q-DEC').sum() # same as above

>>> s.resample('QS').sum() # defaults to QS-JAN
2012-01-01    457
2012-04-01    404
2012-07-01    401
2012-10-01    415
2013-01-01    383
2013-04-01    382
2013-07-01    398
2013-10-01    387
Freq: QS-JAN, dtype: int64

>>> s.resample('QS-DEC').sum()
2011-12-01    299
2012-03-01    427
2012-06-01    381
2012-09-01    438
2012-12-01    386
2013-03-01    396
2013-06-01    375
2013-09-01    414
2013-12-01    111
Freq: QS-DEC, dtype: int64

Problem description

The docs have

(B)Q(S)-DEC quarterly frequency, year ends in December. Same as ‘Q’

But QS is the same as QS-JAN not December. The same thing for AS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions