Skip to content

Quarter.onOffset looks fishy #18235

Open
Open
@jbrockmendel

Description

@jbrockmendel
qe = pd.offsets.QuarterEnd(startingMonth=2)
qs = pd.offsets.QuarterBegin(startingMonth=2)
bqe = pd.offsets.BQuarterEnd(startingMonth=2)
bqs = pd.offsets.BQuarterBegin(startingMonth=2)

feb1 = pd.Timestamp('2017-02-01')
feb28 = pd.Timestamp('2017-02-28')
apr30 = pd.Timestamp('2017-04-30')

>>> qs.onOffset(feb1)
True
>>> qe.onOffset(feb28)
True
>>> qe.onOffset(apr30)
False

>>> bqs.onOffset(feb1)
True
>>> bqe.onOffset(feb28)
True
>>> bqe.onOffset(apr30)
False

The QuarterStart behavior makes sense to me; the QuarterEnd does not. If Feb1 is the start of a quarter, shouldn't the end of that same quarter be Apr30?

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