Skip to content

DOC: update the pandas.Series.dt.total_seconds docstring #20159

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 13, 2018

Conversation

ijmbarr
Copy link
Contributor

@ijmbarr ijmbarr 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"
  • 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.total_seconds) ##################
################################################################################

Return total duration of each element expressed in seconds.

Return a series with the same length and index as the original,
containing the length of each element expressed in seconds.

Returns
-------
s : pandas.Series
    a series of type `float64`.

Examples
--------
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='d'))
>>> s
0   0 days
1   1 days
2   2 days
3   3 days
4   4 days
dtype: timedelta64[ns]
>>> s.dt.total_seconds()
0         0.0
1     86400.0
2    172800.0
3    259200.0
4    345600.0
dtype: float64

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

Errors found:
        Errors in parameters section
                Parameters {'args', 'kwargs'} not documented
        See Also section not 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.

Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

-------
s : pandas.Series
a series of type `float64`.

Copy link
Contributor

Choose a reason for hiding this comment

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

See Alsosection is missing. Maybe it could be useful to reference datetime documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Looks good to me! (added minor comment)

@TomAugspurger we have again the problem of index vs .dt accessor. Did we already have a solution for this? (the current PR now documents it like .dt)

Returns
-------
s : pandas.Series
a series of type `float64`.
Copy link
Member

Choose a reason for hiding this comment

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

"a series" -> "Series"

@codecov
Copy link

codecov bot commented Mar 13, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20159      +/-   ##
==========================================
- Coverage   91.72%    91.7%   -0.03%     
==========================================
  Files         150      150              
  Lines       49156    49165       +9     
==========================================
- Hits        45090    45087       -3     
- Misses       4066     4078      +12
Flag Coverage Δ
#multiple 90.09% <ø> (-0.03%) ⬇️
#single 41.86% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/timedeltas.py 91.03% <ø> (ø) ⬆️
pandas/plotting/_converter.py 65.07% <0%> (-1.74%) ⬇️
pandas/core/series.py 93.84% <0%> (-0.02%) ⬇️
pandas/core/base.py 96.78% <0%> (-0.02%) ⬇️
pandas/core/indexes/base.py 96.66% <0%> (-0.01%) ⬇️
pandas/core/strings.py 98.32% <0%> (ø) ⬆️
pandas/core/indexing.py 93.02% <0%> (ø) ⬆️
pandas/core/groupby.py 92.14% <0%> (ø) ⬆️
pandas/plotting/_misc.py 38.98% <0%> (ø) ⬆️
pandas/core/indexes/multi.py 95.06% <0%> (ø) ⬆️
... and 8 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 840d432...41bfa9d. Read the comment docs.

@TomAugspurger
Copy link
Contributor

Made this generic for TimedeltaIndex and Series[timedelta64].

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 13, 2018
@TomAugspurger TomAugspurger added Datetime Datetime data dtype Timedelta Timedelta data type labels Mar 13, 2018
@TomAugspurger TomAugspurger merged commit 51765d0 into pandas-dev:master Mar 13, 2018
@jorisvandenbossche
Copy link
Member

Yes, that looks like a good solution

@ijmbarr ijmbarr deleted the docstring_total_seconds branch March 13, 2018 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Docs Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants