Skip to content

DOC: update the pandas.Series.dt.is_quarter_end docstring #20279

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 2 commits into from
Mar 14, 2018

Conversation

janelle
Copy link
Contributor

@janelle janelle commented Mar 11, 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:

################################################################################
################# Docstring (pandas.Series.dt.is_quarter_end)  #################
################################################################################

Return a boolean indicating whether the date is the last day of a
quarter.

Returns
-------
is_quarter_end : Series of boolean.

See Also
--------
quarter : Return the quarter of the date.

is_quarter_start : Return a boolean indicating whether the date is the
    first day of the quarter.

Examples
--------
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
...                   periods=4)})
>>> df.assign(quarter = df.dates.dt.quarter,
...          is_quarter_end = df.dates.dt.is_quarter_end)
       dates  quarter    is_quarter_end
0 2017-03-30        1             False
1 2017-03-31        1              True
2 2017-04-01        2             False
3 2017-04-02        2             False

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

Errors found:
	No summary found (a short summary in a single line should be present at the beginning of the docstring)

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.

  • No extended summary required.
  • Short summary exceeds one line by one word, hope that is ok

Copy link
Contributor

@dukebody dukebody left a comment

Choose a reason for hiding this comment

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

Only minor pep8 formatting issue. I agree this is so simple an extended description is not really needed.

--------
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
... periods=4)})
>>> df.assign(quarter = df.dates.dt.quarter,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say no spaces around the = sign here to follow pep8.

@@ -1739,7 +1739,33 @@ def freq(self, value):
is_quarter_end = _field_accessor(
'is_quarter_end',
'is_quarter_end',
"Logical indicating if last day of quarter (defined by frequency)")
"""
Return a boolean indicating whether the date is the last day of a
Copy link
Contributor

Choose a reason for hiding this comment

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

See if you can reprhase to get this on a single line


Returns
-------
is_quarter_end : Series of boolean.
Copy link
Contributor

Choose a reason for hiding this comment

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

is_quarter_end : Series or DatetimeIndex
    The same type as the original data. Series will have the same
    name and index. DatetimeIndex will have the same name.


See Also
--------
quarter : Return the quarter 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.

Examples
--------
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
... periods=4)})
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP: indent periods under the quote in date_range(

>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
... periods=4)})
>>> df.assign(quarter = df.dates.dt.quarter,
... is_quarter_end = df.dates.dt.is_quarter_end)
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8: one more space

1 2017-03-31 1 True
2 2017-04-01 2 False
3 2017-04-02 2 False
""")
Copy link
Contributor

Choose a reason for hiding this comment

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

Example for DatetimeIndex

@TomAugspurger TomAugspurger added the Datetime Datetime data dtype label Mar 14, 2018
@TomAugspurger TomAugspurger merged commit 52ef641 into pandas-dev:master Mar 14, 2018
@TomAugspurger
Copy link
Contributor

Thanks @janelle!

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants