API: Add Calendar Day Frequency ("CD")
See original GitHub issueThis is a proposal to replace #20633.
offsets.Day
('D'
) is documented to represent calendar day; however, Day
arithmetic and usage of the 'D'
offset alias (e.g. df.resample('D')
, timedelta_range(..., freq='D')
, etc.) currently respects absolute time (i.e. Day
acts like Timedelta(days=1)
). This usage is ingrained pretty deeply in a lot of methods and operations and is fairly difficult to walk back to respect the notion of calendar day as stated in the docs.
Instead, I propose to keep Day
as is (a timedelta-like frequency like Hour
('H'
)) and add a new frequency CalendarDay
, 'CD'
. It would act very similarly to DateOffset(day=1)
but act like a frequency. Thoughts?
Issue Analytics
- State:
- Created 5 years ago
- Comments:31 (31 by maintainers)
Top Results From Across the Web
Events: insert | Google Calendar
Property name Value Notes
end nested object
start nested object
anyoneCanAddSelf boolean writable
Read more >8 DateOffset objects — Pandas Doc - GitHub Pages
DateOffset, Generic offset class, defaults to 1 calendar day. BDay, business day (weekday). CDay, custom business day (experimental).
Read more >oracle.as.scheduler Class Recurrence
Frequency is always mandatory when defining a recurrence pattern based on recurrence fields. ... Method to add a day of month to this...
Read more >5.5. Date and Time Calendar - Python
tseries.holiday import AbstractHolidayCalendar, Holiday, EasterMonday, Easter >>> from pandas.tseries.offsets import Day, CustomBusinessDay, CustomBusinessHour ...
Read more >Get business days between start and end date using pandas
You can also use date_range for this purpose. In [3]: pd.date_range('2011-01-05', '2011-01-09', freq=BDay()) Out[3]: DatetimeIndex(['2011-01-05', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Only partially related, but I’ve also thought it would be nice to have frequencies for other DateOffset cases, e.g. a calendar year like the below.
So, maybe a whole set of
'CD', 'CM', 'CA'
?Closing in favor of further discussion in #22864 (especially about deprecation procedure)