question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: subclassing `CustomBusinessDay` returns init error

See original GitHub issue

Pandas 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:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
attack68commented, Aug 15, 2022

Yes I’ve already made the switch. I’m more used to subclassing, but here its just not worth it. Thanks for the help.

1reaction
attack68commented, Aug 15, 2022

yes, of course! excellent solution, many thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found