-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Fixed examples in pandas/tseries #32935
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
DOC: Fixed examples in pandas/tseries #32935
Conversation
pandas/tseries/frequencies.py
Outdated
@@ -95,16 +95,18 @@ def to_offset(freq) -> Optional[DateOffset]: | |||
|
|||
Examples | |||
-------- | |||
>>> to_offset('5min') | |||
>>> import datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timedelta is in the module namespace. instead of importing here, would this be fixed by changing datetime.timedelta
on L110 to just timedelta
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest
is having a scope for each docstring, so in order to have timedelta
instead of datetime.timedelta
, L98 would have to be from datetime import timedelta
.
Another option (which IMO is least preferred, is to import it below, at L109 for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we always have pd
in the namespace right? how about pd.Timedelta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we always have
pd
in the namespace right? how aboutpd.Timedelta
Worked!
>>> July3rd = Holiday('July 3rd', month=7, day=3, | ||
days_of_week=(0, 1, 2, 3)) | ||
|
||
>>> USMemorialDay = Holiday( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does a code check complain about this without this change? this makes it harder to copy/paste an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, flake8 complains that this line's length is larger than 88 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks @MomIsBestFriend |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff