Skip to content

DOC: update the pandas.Series.dt.is_year_end docstring #20274

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 5 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_year_end) ###################
################################################################################

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

Returns
-------
is_year_end : Series of boolean.

See Also
--------
is_year_start : Return a boolean indicating whether the date is the first day of the year.

Examples
--------
>>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
>>> dates
0   2017-12-30
1   2017-12-31
2   2018-01-01
dtype: datetime64[ns]
>>> dates.dt.is_year_end
0    False
1     True
2    False
dtype: bool

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

Errors found:
	No extended summary found

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

@pep8speaks
Copy link

pep8speaks commented Mar 11, 2018

Hello @janelle! Thanks for updating the PR.

Line 1793:80: E501 line too long (80 > 79 characters)

Comment last updated on March 14, 2018 at 18:55 Hours UTC

"Logical indicating if last day of year (defined by frequency)")
"""
Return a boolean indicating whether the date is the last day of the
year.
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 be a single line. Does

Return a boolean array of whether the date is the year's last day.

fit on a single line?

Copy link
Member

Choose a reason for hiding this comment

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

Boolean array is not correct in case of Series ...

(but I agree that just "boolean" does not reflect is returns a boolean for each element)

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps just

Return an indicator for whether each date is the last day of the year.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's better. Or maybe even shorter "Indicate whether ..." instead of "Return an indicator whether .." ?

1 True
2 False
dtype: bool
""")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add an example with just a DatetimeIndex? Can be the same values, and don't have to show the values again,

>>> pd.date_range('2017-12-30", periods=3).is_year_end

and show the output


Returns
-------
is_year_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.

Ah, this return type depends on the type of self. So I think

is_year_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
--------
is_year_start : Return a boolean indicating whether the date is the
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment #20275 (comment) (once we figure out how to handle these)

@TomAugspurger
Copy link
Contributor

Updated. Fixed some some See Alsos in the other docstrings where we said method instead of property.

Thanks again @janelle!

@TomAugspurger TomAugspurger merged commit c124e47 into pandas-dev:master Mar 14, 2018
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.

4 participants