Skip to content

DateOffset objects should support rollback on arrays #7449

@shoyer

Description

@shoyer

Use case: I would like to be able to rollback a datetime Series or Index, mapping each value to the first day of each month.

I suppose this will probably need Cython to be fast.

Example:

import pandas as pd

dates = pd.date_range('2000-01-01', periods=100)
offset = pd.tseries.offsets.MonthBegin()

print dates - offset # this works, but is wrong for the first day of each month
print pd.Index([offset.rollback(d) for d in dates]) # this works correctly but slowly
print offset.rollback(dates) # this should, but doesn't

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions