-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the Period.days_in_month docstring #20297
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: update the Period.days_in_month docstring #20297
Conversation
pandas/_libs/tslibs/period.pyx
Outdated
-------- | ||
Period.daysinmonth : Returns the number of days in the month. | ||
DatetimeIndex.daysinmonth : Return the number of days in the month. | ||
calendar.monthrange : Return a tuple containing weekday |
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.
In See Also section : place of Returns use Get
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.
apart from this LGTM
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.
Sure! I will make the suggested changes. Thanks for the review.
pandas/_libs/tslibs/period.pyx
Outdated
28 | ||
|
||
>>> import datetime | ||
>>> pd.Period(datetime.datetime.today(), freq= 'B').days_in_month |
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.
Can you avoid datetime.today()
? This won't pass doctests, aside from ~half the months in the year :)
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.
yeah sure !! Please pardon my naivety and this is a lifetime learning for sure. :)
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.
Should I just remove the second example because I couldn't think of any other way around of using this attribute different than the first 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.
Using Period('2018-03-01').days_in_month
should be fine.
pandas/_libs/tslibs/period.pyx
Outdated
|
||
See Also | ||
-------- | ||
Period.daysinmonth : Returns the number of days in the month. |
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.
Returns -> Return
pandas/_libs/tslibs/period.pyx
Outdated
28 | ||
|
||
>>> import datetime | ||
>>> pd.Period(datetime.datetime.today(), freq= 'B').days_in_month |
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.
Using Period('2018-03-01').days_in_month
should be fine.
pandas/_libs/tslibs/period.pyx
Outdated
|
||
Examples | ||
-------- | ||
>>> p= pd.Period('2018-2-17') |
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.
pep8: space before the =
pandas/_libs/tslibs/period.pyx
Outdated
|
||
Handles the leap year case as well: | ||
|
||
>>> p= pd.Period('2016-2-17') |
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.
space before the =
@himanshuawasthi95 @TomAugspurger, Made the suggested changes. Please Review. |
@Tushar987 Did you push your changes with the PEP8 fixes (the spaces before the |
Oh, also the |
@TomAugspurger, Sorry! forgot to push changes. Please review. |
Looks good, thanks! |
Hmm, I also recently merged PR for |
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>