BUG: subclassing `CustomBusinessDay` returns init error
See original GitHub issuePandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday
from pandas.tseries.offsets import CustomBusinessDay
rules = [Holiday("MyHol", month=1, day=3)]
cal = CustomBusinessDay(calendar=AbstractHolidayCalendar(rules=rules))
print(cal.rollforward("2022-01-03"))
# 2022-01-04 00:00:00
class MyCal(CustomBusinessDay):
def __init__(self, rules):
super().__init__(calendar=AbstractHolidayCalendar(rules=rules))
cal = MyCal(rules=rules)
print(cal.rollforward("2022-01-03"))
# TypeError: __init__() got an unexpected keyword argument 'normalize'
Issue Description
If I create a CustomBusinessDay
calendar I can roll it forward without issue.
If I subclass it and initialise as, I perceive to be, the same structure it returns a TypeError
.
Expected Behavior
I expect the two construction routines to be identical.
Installed Versions
pandas : 1.5.0.dev0+1283.g03b4095f9d
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
What's new in 1.4.0 (January 22, 2022) - Pandas
The error raised when an optional dependency can't be imported now includes the ... Bug in DataFrame arithmetic ops with a subclass whose...
Read more >python2-pandas-0.23.4-bp153.1.19 RPM for x86_64 - RPMFind
Accessing a level that has a duplicate name by name still raises an error (GH19029). + Bug in both DataFrame.first_valid_index() and ...
Read more >Release 1.6.0 unknown - Zipline Trader
return bm.pct_change(periods=1).fillna(0) def initialize(context): context.equity = symbol("AMZN") def handle_data(context, data):.
Read more >pandas: powerful Python data analysis toolkit - Amazon S3
list will return a plain-old-Index; indexing with a Categorical ... Fixed bug where DataFrame.plot() raised an error when both color and ...
Read more >TypeError: __init__() missing 2 required positional arguments
__init__(x,y) self.radius=radius def area(self): return ... You should only define data intended for all subclasses inheriting from the base. width and ...
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 Free
Top 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
Yes I’ve already made the switch. I’m more used to subclassing, but here its just not worth it. Thanks for the help.
yes, of course! excellent solution, many thanks.