-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update the Period.day docstring #20294
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.day docstring #20294
Conversation
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1217,6 +1217,32 @@ cdef class _Period(object): | |||
|
|||
@property | |||
def day(self): | |||
""" | |||
Return the number of days of particular month of a given Period. |
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.
This description would make me think this gives the number of days of the month the period falls in, i.e. if the month was February it would return 28. That's obviously note the case - can you think of a way to reword and make clearer?
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 try to make this more clear I'm still thinking that summary is not good sense .
I have query : if we give any period like 2018-03-28 it return 28 so how i explain because I think it count all days till given date ?
If I think wrong correct me :)
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.
I would say "Get day of the month that a Period falls on"
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.
I didn't find better sort explanation as you mention on above comment
pandas/_libs/tslibs/period.pyx
Outdated
""" | ||
Return the number of days of particular month of a given Period. | ||
|
||
This attribute returns the total number of days of given month on which |
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.
This is a pretty simple function so depending on how concise the short summary is might be OK to not have an extended summary
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.
but I think when I remove extended summary validation_docstring.py gives error ???
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.
You are right that the script would fail but I think this would pass as an exception
pandas/_libs/tslibs/period.pyx
Outdated
|
||
Returns | ||
------- | ||
Int |
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.
lowercase this
pandas/_libs/tslibs/period.pyx
Outdated
Returns | ||
------- | ||
Int | ||
Number of days till particular date |
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.
This should be indented. Might want to reword based off of what you do with short summary
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.
still have confusion ?
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.
Take a look at the contributing guide for the sprint. The very first example should show you how to format the Returns section
https://python-sprints.github.io/pandas/guide/pandas_docstring.html
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 I write :
int
day of that 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.
or day of given 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.
Just write int here - this is simple enough that you don't need a description
For future reference though when you do put a description on the line below the type it needs to be indented (i.e. 4 spaces ahead of the line above)
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
pandas/_libs/tslibs/period.pyx
Outdated
See also | ||
-------- | ||
Period.dayofweek | ||
Return the day of the week |
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 this section the description should be on the same line as the referenced item separated by a " : "
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.
mean ===>>>>(Period.dayofweek: Return the day of the week)
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.
Put a space before the colon and change the word "Return" to "Get" and yes you are correct
pandas/_libs/tslibs/period.pyx
Outdated
|
||
Examples | ||
-------- | ||
>>> import pandas as pd |
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.
No need for import pandas as pd
for any docstrings as it is implied (nor import numpy as np
)
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.
sorry my mistake
pandas/_libs/tslibs/period.pyx
Outdated
Int | ||
Number of days till particular date | ||
|
||
See also |
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.
Capitalize Also
Codecov Report
@@ Coverage Diff @@
## master #20294 +/- ##
==========================================
+ Coverage 91.7% 91.73% +0.02%
==========================================
Files 150 150
Lines 49168 49168
==========================================
+ Hits 45090 45102 +12
+ Misses 4078 4066 -12
Continue to review full report at Codecov.
|
@himanshuawasthi95 Thanks for the PR, and @WillAyd thanks for the review! |
Thanks @jorisvandenbossche and @WillAyd |
Period.day Docstring
################################################################################
######################## Docstring (pandas.Period.day) ########################
################################################################################
Return the number of days of particular month of a given Period.
This attribute returns the total number of days of given month on which
the particular date occurs.
Returns
Int
Number of days till particular date
See also
Period.dayofweek
Return the day of the week
Period.dayofyear
Return the day of the year
Examples
################################################################################
################################## Validation ##################################
################################################################################
Docstring for "pandas.Period.day" correct. :)