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

DateOffset for weekday argument requires weekday argument from dateutil #648

Closed
Dr-Irv opened this issue Apr 13, 2023 · 2 comments · Fixed by #1010
Closed

DateOffset for weekday argument requires weekday argument from dateutil #648

Dr-Irv opened this issue Apr 13, 2023 · 2 comments · Fixed by #1010

Comments

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Apr 13, 2023

The issue is that the type specification for the weekday argument in pandas-stubs/_libs/tslibs/offsets.pyi says that weekday is an int. But it can be a weekday class or an int. See https://dateutil.readthedocs.io/en/stable/relativedelta.html To fix this, we have to make types-python-dateutil a dependency, which involves modifying pyproject.toml and takes some care.

Created a docs issue for pandas at pandas-dev/pandas#52650

Originally posted by @Dr-Irv in #645 (comment)

@twoertwein
Copy link
Member

In quite a few cases, the code seems to explicitly test that weekday is between 0 and 6 (WeekOfMonthMixin, Week, WeekOfMonth).

@loicdiridollou
Copy link
Contributor

In quite a few cases, the code seems to explicitly test that weekday is between 0 and 6 (WeekOfMonthMixin, Week, WeekOfMonth).

For the other ones you mentioned, there is a type check at the __init__ so you can only pass a weekday class from dateutil.relativedelta in pd.DateOffset. Let me know if I missed anything!

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.

3 participants