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

[enhancement] Aggregation to non-calendar periods #57

Closed
rwijtvliet opened this issue Nov 13, 2023 · 2 comments · Fixed by #97
Closed

[enhancement] Aggregation to non-calendar periods #57

rwijtvliet opened this issue Nov 13, 2023 · 2 comments · Fixed by #97
Assignees

Comments

@rwijtvliet
Copy link
Owner

rwijtvliet commented Nov 13, 2023

Currently, the aggregation for PfLine and PfState instances is done with .asfreq(freq), with the parameter freq being "MS", "QS", or "'AS'", to aggregate to monthly, quarterly, or yearly values.

What is not yet possible, is to aggregate to e.g. business years (let's say starting at April 1), or to time periods of e.g. 15 months.

The following proposal (up for discussion):

  1. Allow not only "AS", but also e.g. "AS-APR" as value for freq. This would aggregate the values between April 1 0:00 (incl) and April 1 0:00 (excl) the next year. Compare:
>>> pd.date_range('2022', freq="AS-APR", periods=10)
DatetimeIndex(['2022-04-01', '2023-04-01', '2024-04-01', '2025-04-01',
               '2026-04-01', '2027-04-01', '2028-04-01', '2029-04-01',
               '2030-04-01', '2031-04-01'],
              dtype='datetime64[ns]', freq='AS-APR')
  1. For more exotic aggregations, allow "all" as value for freq. This would aggregate over all time periods in the PfLine or PfState. Here, the implications are a bit more difficult, as this is not supported out of the box by pandas.
@rwijtvliet rwijtvliet changed the title Aggregation to non-calendar periods [enhancement] Aggregation to non-calendar periods Nov 15, 2023
@Pizza2Pizza Pizza2Pizza self-assigned this May 14, 2024
@rwijtvliet
Copy link
Owner Author

See attached xlsx for more elaborate explanation
explainer.xlsx

@rwijtvliet
Copy link
Owner Author

image

@Pizza2Pizza Pizza2Pizza mentioned this issue Jul 2, 2024
@Pizza2Pizza Pizza2Pizza linked a pull request Jul 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants