DateOffset.offset vs DateOffset._offset
See original GitHub issuetseries.offsets.DateOffset
has a _offset
attribute. Many subclasses do not have this attribute, but do have a offset
attribute. The main difference in the two appears to be that _offset
is ignored by __eq__
(see #17137).
The question: why two separate attributes? Is this intentional or coincidence?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
pandas.tseries.offsets.DateOffset
Each offset specify a set of dates that conform to the DateOffset. For example, Bday defines this set to be the set of...
Read more >Python | Pandas tseries.offsets.DateOffset - GeeksforGeeks
DateOffsets work as follows, each offset specify a set of dates that conform to the DateOffset. For example, Bday defines this set to...
Read more >Pandas DateOffset, step back one day - Stack Overflow
You can check pandas.tseries.offsets.DateOffset : *kwds Temporal parameter that add to or replace the offset value. Parameters that add to the offset (like ......
Read more >Converting between DateTime and DateTimeOffset
DateTimeOffset reflects a time's offset from UTC, but it doesn't reflect the actual time zone to which that offset belongs. For more information ......
Read more >8 DateOffset objects — Pandas Doc - GitHub Pages
Offsets can be used with either a Series or DatetimeIndex to apply the offset to each element. In [29]: rng = pd.date_range( ...
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
There are some inconsistencies in how
offsets
handleskwds
that need to be cleaned up if we want offsets to be immutable. I have not found a way to clean them up that maintains backward compatibility in extremely weird corner cases. TakeBusinessDay
as an example:I’d like to get a green-light to change this behavior:
Similar behavior shows up in the other
BusinessFooOffset
s,Week
, andQuarterOffset
. Many of the others will display unwanted behavior if users pass unsupported keyword args:Best case I’d like to get rid of
DateOffset.kwds
altogether and explicitly specify the args/kwargs in the various__init__
methods (this will require patching a few other methods that checkself.kwds
, but that isn’t a big deal). That will break backward compat for any users who-- for some reason-- explicitly use that attribute.If that is too big a break, the next-best option would be to
add validation in
__init__
that only supported kwargs have been passed (this is done in a few existing code paths). This will take care of theSemiMonthBegin(clark='kent')
cases.ensure that default values for
kwds
are handled consistently. e.g. in theBusinessDay.__init__
example above,kwds.get('offset', timedelta(0))
would be changed tokwds.setdefault('offset', timedelta(0))
.yep those look wrong
why don’t do a PR just to fix those