-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the Period.qyear docstring #20333
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.qyear docstring #20333
Conversation
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1408,6 +1408,25 @@ cdef class _Period(object): | |||
|
|||
@property | |||
def qyear(self): | |||
""" | |||
Return a year of the given 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.
year of the given date not appropriate . I'd say "Get the year component of the Period."
pandas/_libs/tslibs/period.pyx
Outdated
""" | ||
Return a year of the given date. | ||
|
||
This function simply find the year of the given date that period fallsin. |
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 can get rid of extended summary because its already clear from summary
pandas/_libs/tslibs/period.pyx
Outdated
|
||
See Also | ||
-------- | ||
Period.qyear :Return the year of the 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.
add pqyear in See Also section
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 fix the spacing here? Space after the :
Codecov Report
@@ Coverage Diff @@
## master #20333 +/- ##
==========================================
- Coverage 91.9% 91.84% -0.06%
==========================================
Files 160 153 -7
Lines 49904 49256 -648
==========================================
- Hits 45864 45241 -623
+ Misses 4040 4015 -25
Continue to review full report at Codecov.
|
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 remove the extra .save
file from your PR?
Signed-off-by: uttamaniket <[email protected]>
Signed-off-by: uttamaniket <[email protected]>
Signed-off-by: uttamaniket <[email protected]>
Signed-off-by: uttamaniket <[email protected]>
Can you figure out how |
pandas/_libs/tslibs/period.pyx
Outdated
|
||
See Also | ||
-------- | ||
Period.qyear : Return the year of the 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.
Isn't this Period.qyear
? If so, it shouldn't be listed under See Also.
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.
int
--> year : int
(or qyear : int
)
Signed-off-by: uttamaniket <[email protected]>
Signed-off-by: uttamaniket <[email protected]>
@TomAugspurger I am not getting difference between qyear and year. If any advice for me then please give me. |
Not sure. Perhaps @jbrockmendel knows. |
I think the distinction is for
|
Thanks @jbrockmendel for your advice. |
Signed-off-by: uttamaniket <[email protected]>
Please check the PR @jbrockmendel and give review. |
pandas/_libs/tslibs/period.pyx
Outdated
|
||
Returns | ||
------- | ||
int --> qyear : 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.
This should just be int
or qyear : int
.
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1408,6 +1408,30 @@ cdef class _Period(object): | |||
|
|||
@property | |||
def qyear(self): | |||
""" | |||
Get the year component of the 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 should differentiate .qyear
from just .year
pandas/_libs/tslibs/period.pyx
Outdated
>>> p = pd.Period('2014Q1', freq="Q") | ||
>>> p.qyear | ||
2014 | ||
|
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.
It'd be good to add a bit of text explaining the difference here. Something like
The fiscal-quarter year can differ from the calendar year.
+1 to each of Tom's points. |
Signed-off-by: uttamaniket <[email protected]>
@TomAugspurger review it. |
@jbrockmendel can you please review? |
pandas/_libs/tslibs/period.pyx
Outdated
Get the fiscal year component of the Period. | ||
|
||
The `year` and the `qyear` of the period will be the same if the fiscal | ||
and the natural years are the same. When they are not, the fiscal 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.
"natural" --> "calendar"
pandas/_libs/tslibs/period.pyx
Outdated
|
||
See Also | ||
-------- | ||
Period.year : Return the natural year of the 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.
natural --> calendar
pandas/_libs/tslibs/period.pyx
Outdated
>>> per.year | ||
2018 | ||
|
||
If the fiscal year starts in April (`Q-MAR`), the first qearter of |
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.
qearter --> quarter
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1463,6 +1463,45 @@ cdef class _Period(object): | |||
|
|||
@property | |||
def qyear(self): | |||
""" | |||
Get the fiscal year component of the 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.
Find the fiscal year the Period lies in according to the specified starting-quarter.
Thanks for the contribution @uttamaniket, and sorry for the delay in taking care of it. |
* DOC: update the Period.qyear docstring * DOC: update the Period.qyear docstring * DOC: update the Period.qyear docstring * DOC: update the Period.qyear docstring * update qyear Signed-off-by: uttamaniket <[email protected]> * update qyear Signed-off-by: uttamaniket <[email protected]> * update qyear Signed-off-by: uttamaniket <[email protected]> * update qyear Signed-off-by: uttamaniket <[email protected]> * update Period.qyear Signed-off-by: uttamaniket <[email protected]> * update Period.qyear Signed-off-by: uttamaniket <[email protected]> * update pandas.qyear Signed-off-by: uttamaniket <[email protected]> * update qyear Signed-off-by: uttamaniket <[email protected]> * Adding extra clarification on how year and qyear are different * Addressing last comments from @jbrockmendel
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
PR title is "DOC: update the docstring"
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>
Please include the output of the validation script below between the "```" ticks:
If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.