Skip to content

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

Merged
merged 17 commits into from
Jul 8, 2018

Conversation

uttamaniket
Copy link
Contributor

@uttamaniket uttamaniket commented Mar 13, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

PR title is "DOC: update the docstring"

  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

(pandas_dev) ani@ani-Lenovo-G50-80:~/github/pandas/scripts$ python validate_docstrings.py  

- [ ] pandas.Period.qyear

################################################################################
####################### Docstring (pandas.Period.qyear)  #######################
################################################################################

Return a year of the given date.

This function simply find the year of the given date that period fallsin.

Returns
-------
int

See Also
--------
Period.qyear :Return the year of the date

Examples
--------
>>> p = pd.Period("2014-9-21", freq="A")
>>> p.qyear
2014

################################################################################
################################## Validation ##################################
################################################################################

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.

@@ -1408,6 +1408,25 @@ cdef class _Period(object):

@property
def qyear(self):
"""
Return a year of the given date.

Copy link
Contributor

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."

"""
Return a year of the given date.

This function simply find the year of the given date that period fallsin.
Copy link
Contributor

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


See Also
--------
Period.qyear :Return the year of the date
Copy link
Contributor

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

Copy link
Contributor

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
Copy link

codecov bot commented Mar 14, 2018

Codecov Report

Merging #20333 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.23% <ø> (-0.06%) ⬇️
#single 41.9% <ø> (-0.2%) ⬇️
Impacted Files Coverage Δ
pandas/core/arrays/base.py 84.14% <0%> (-3.72%) ⬇️
pandas/io/formats/printing.py 89.38% <0%> (-3.71%) ⬇️
pandas/core/indexes/period.py 92.61% <0%> (-1.8%) ⬇️
pandas/core/dtypes/missing.py 91.07% <0%> (-1.46%) ⬇️
pandas/core/reshape/tile.py 93.37% <0%> (-1.37%) ⬇️
pandas/plotting/_core.py 82.5% <0%> (-1.07%) ⬇️
pandas/util/_test_decorators.py 91.89% <0%> (-0.8%) ⬇️
pandas/core/tools/datetimes.py 84.43% <0%> (-0.79%) ⬇️
pandas/core/indexing.py 93.02% <0%> (-0.71%) ⬇️
pandas/io/common.py 70.04% <0%> (-0.62%) ⬇️
... and 69 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6008d75...ca3beb5. Read the comment docs.

Copy link
Contributor

@TomAugspurger TomAugspurger left a 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]>
@TomAugspurger
Copy link
Contributor

TomAugspurger commented Mar 17, 2018

Can you figure out how qyear differs from year?


See Also
--------
Period.qyear : Return the year of the date
Copy link
Member

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.


Returns
-------
int
Copy link
Member

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]>
@uttamaniket
Copy link
Contributor Author

@TomAugspurger I am not getting difference between qyear and year. If any advice for me then please give me.

@TomAugspurger
Copy link
Contributor

Not sure. Perhaps @jbrockmendel knows.

@jbrockmendel
Copy link
Member

I think the distinction is for freqs where the calendar-quarter doesn't line up with the fiscal quarter.

per = pd.Period('2016Q1', freq='Q')
per2 = pd.Period('2016Q1', freq='Q-JUN')

>>> per.start_time
Timestamp('2016-01-01 00:00:00')

>>> per2.start_time
Timestamp('2015-07-01 00:00:00')

>>> per2.year
2015
>>> per2.qyear
2016

@uttamaniket
Copy link
Contributor Author

Thanks @jbrockmendel for your advice.

Signed-off-by: uttamaniket <[email protected]>
@uttamaniket
Copy link
Contributor Author

Please check the PR @jbrockmendel and give review.


Returns
-------
int --> qyear : int
Copy link
Contributor

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.

@@ -1408,6 +1408,30 @@ cdef class _Period(object):

@property
def qyear(self):
"""
Get the year component of the Period.
Copy link
Contributor

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

>>> p = pd.Period('2014Q1', freq="Q")
>>> p.qyear
2014

Copy link
Contributor

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.

@jbrockmendel
Copy link
Member

+1 to each of Tom's points.

Signed-off-by: uttamaniket <[email protected]>
@uttamaniket
Copy link
Contributor Author

@TomAugspurger review it.

@datapythonista datapythonista self-assigned this Jul 8, 2018
@datapythonista
Copy link
Member

@jbrockmendel can you please review?

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"natural" --> "calendar"


See Also
--------
Period.year : Return the natural year of the period.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

natural --> calendar

>>> per.year
2018

If the fiscal year starts in April (`Q-MAR`), the first qearter of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qearter --> quarter

@@ -1463,6 +1463,45 @@ cdef class _Period(object):

@property
def qyear(self):
"""
Get the fiscal year component of the Period.
Copy link
Member

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.

@datapythonista datapythonista merged commit 486bfe8 into pandas-dev:master Jul 8, 2018
@datapythonista
Copy link
Member

Thanks for the contribution @uttamaniket, and sorry for the delay in taking care of it.

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants