Skip to content

POC: rollback_array #52205

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

Closed
wants to merge 1 commit into from
Closed

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

xref #7449, #52105

This implements rollback_array for Month, Quarter, and Year offsets. I've only checked the FooBegin cases and only in non-tzaware cases:

dti = pd.date_range("2016-01-01", periods=60, freq="15D")

mth = pd.offsets.MonthBegin(1)
qtr = pd.offsets.QuarterBegin(1)
yr = pd.offsets.YearBegin(1)


res_mth = pd.DatetimeIndex(mth.rollback_array(dti))
res_qtr = pd.DatetimeIndex(qtr.rollback_array(dti))
res_yr = pd.DatetimeIndex(yr.rollback_array(dti))

exp_mth = pd.DatetimeIndex([mth.rollback(x) for x in dti])
exp_qtr = pd.DatetimeIndex([qtr.rollback(x) for x in dti])
exp_yr = pd.DatetimeIndex([yr.rollback(x) for x in dti])

assert res_mth.equals(exp_mth)
assert res_qtr.equals(exp_qtr)
assert res_yr.equals(exp_yr)

Posting this as a POC so someone else can take it the rest of the way. If no one does I'll circle back to it after focusing on my "do less work on the weekends" goal.

@mroeschke mroeschke added the Frequency DateOffsets label Mar 27, 2023
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Apr 27, 2023
@jbrockmendel
Copy link
Member Author

Mothballing.

@jbrockmendel jbrockmendel added the Mothballed Temporarily-closed PR the author plans to return to label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets Mothballed Temporarily-closed PR the author plans to return to Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants