Skip to content

DOC: Add examples for pandas.tseries.timedeltas #11785

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 1 commit into from
Dec 16, 2015
Merged

DOC: Add examples for pandas.tseries.timedeltas #11785

merged 1 commit into from
Dec 16, 2015

Conversation

proinsias
Copy link
Contributor

Copied examples from the reStructuredText tutorial on timedeltas.

@@ -32,6 +32,20 @@ def to_timedelta(arg, unit='ns', box=True, errors='raise', coerce=None):
Returns
-------
ret : timedelta64/arrays of timedelta64 if parsing succeeded

Examples
--------
Copy link
Member

Choose a reason for hiding this comment

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

You did something strange with the indentation here

@jorisvandenbossche
Copy link
Member

@proinsias Thanks a lot for working on examples in docstrings!

Besides the inline comments, another general: maybe it would be nice to have some text between the different examples to somehow put them a bit into context, eg:

Parsing a single string to a Timedelta:

>>> ...
>>> ...

Parsing a list or array of strings:

>>> ...

Converting numbers by specifying the `unit` keyword argument:

>>> ...

@jorisvandenbossche jorisvandenbossche added this to the 0.18.0 milestone Dec 7, 2015
@proinsias
Copy link
Contributor Author

Thanks for the advice! – I've made these changes and re-pushed the branch.

--------

Parsing a single string to a Timedelta:
>>> pd.to_timedelta('1 days 06:05:01.00003')
Copy link
Member

Choose a reason for hiding this comment

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

Small formatting note: there needs to be a blank line between the two lines above (between the code blocks and the text, so the code blocks are rendered as code, see https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#sections for a full reference)

Copied examples from pandas-docs/stable/timedeltas.html.
jreback added a commit that referenced this pull request Dec 16, 2015
DOC: Add examples for pandas.tseries.timedeltas
@jreback jreback merged commit ee9da4a into pandas-dev:master Dec 16, 2015
@jreback
Copy link
Contributor

jreback commented Dec 16, 2015

thanks!

@proinsias proinsias deleted the doc_tseries_timedeltas_example branch December 16, 2015 14:05
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.

3 participants