Skip to content

DOC: update the pandas.Series.dt.is_leap_year docstring #20184

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

Closed
wants to merge 6 commits into from

Conversation

rok
Copy link
Contributor

@rok rok commented Mar 10, 2018

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

  • PR title is "DOC: update the docstring"
  • [O] 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.tz_convert)  ###################
################################################################################

Convert tz-aware DatetimeIndex from one time zone to another or remove
time zone information (using pytz/dateutil)

Parameters
----------
tz : string, pytz.timezone, dateutil.tz.tzfile or None
    Time zone for time. Corresponding timestamps would be converted to
    time zone of the TimeSeries.
    None will remove timezone holding UTC time.

Returns
-------
normalized : DatetimeIndex

Raises
------
TypeError
    If DatetimeIndex is tz-naive.

See Also
--------
tz_localize : Localize tz-naive DatetimeIndex to given time zone.

Examples
--------
>>> ts = pd.Series([pd.Timestamp("2018-01-01 00:00", tz="US/Eastern"),
...                 pd.Timestamp("2018-02-01 23:00", tz="US/Eastern")])
>>> ts.dt.tz_convert("Europe/Amsterdam")
0   2018-01-01 06:00:00+01:00
1   2018-02-02 05:00:00+01:00
dtype: datetime64[ns, Europe/Amsterdam]

>>> import pytz
>>> london = pytz.timezone('Europe/London')
>>> ts = pd.Series([pd.Timestamp("2018-01-01 00:00", tz=london)])
>>> ts.dt.tz_convert(tz=None)
0   2018-01-01
dtype: datetime64[ns]

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

Errors found:
	No summary found (a short summary in a single line should be present at the beginning of the docstring)
	Errors in parameters section
		Parameters {'kwargs', 'args'} not documented
		Unknown parameters {'tz'}

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.

Comments:

  • I don't know why is tz reported as unknown - it's declared and commented
  • Summary is a bit longer that one row, I hope that is still ok.

@Cheukting
Copy link
Contributor

On top of your summary, could you please add one more short sentence like "Converting time-zone for Datetime" below the """?

Could you also add:
args
Additional arguments passed to the function
kwargs
Additional keyword arguments passed to the function

@rok
Copy link
Contributor Author

rok commented Mar 10, 2018

Validator now reports:

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

Change time zone of Datetime series.

Convert tz-aware DatetimeIndex from one time zone to another or remove
time zone information. The time zone can be specified using a string,
pytz or dateutil.

Parameters
----------
tz : string, pytz.timezone, dateutil.tz.tzfile, None
    Time zone for time. Corresponding timestamps would be converted to
    time zone of the TimeSeries.
    None will remove timezone and return UTC timestamp.
args : iterable, optional
    Additional arguments passed to the function.
kwargs : dict, optional
    Additional keyword arguments passed to the function.

Returns
-------
normalized : DatetimeIndex

Raises
------
TypeError
    If DatetimeIndex is tz-naive.

See Also
--------
tz_localize : Localize tz-naive DatetimeIndex to given time zone.

Examples
--------
>>> ts = pd.Series([pd.Timestamp("2018-01-01 00:00", tz="US/Eastern"),
...                 pd.Timestamp("2018-02-01 23:00", tz="US/Eastern")])
>>> ts.dt.tz_convert("Europe/Amsterdam")
0   2018-01-01 06:00:00+01:00
1   2018-02-02 05:00:00+01:00
dtype: datetime64[ns, Europe/Amsterdam]

>>> import pytz
>>> pacific = pytz.timezone('US/Pacific')
>>> ts = pd.Series([pd.Timestamp("2018-01-01 01:00", tz=pacific)])
>>> ts.dt.tz_convert(tz=None)
0   2018-01-01 09:00:00
dtype: datetime64[ns]

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

Errors found:
	Errors in parameters section
		Unknown parameters {'tz'}

@jreback jreback changed the title DOC: update the pandas.Series.dt.tz_convert docstring DOC: update the pandas.Series.dt.is_leap_year docstring Mar 10, 2018
@jreback jreback added Docs Datetime Datetime data dtype labels Mar 10, 2018
@jorisvandenbossche
Copy link
Member

This was merged in #20150

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