Skip to content

Resolution docstring #21122

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 21 commits into from
Jul 8, 2018
Merged
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4dcb4b4
updated docstring for nanoseconds function
chalmerlowe May 15, 2018
e0ae113
Merge remote-tracking branch 'upstream/master' into nanosecond-docstring
chalmerlowe May 15, 2018
11a9266
DOC: updated docstring for nanoseconds function per doc guidelines
chalmerlowe May 15, 2018
04e204b
DOC: added examples to nanoseconds function and minor formatting edits
chalmerlowe May 15, 2018
5ac6ef1
DOC: added example header
chalmerlowe May 15, 2018
fb45759
DOC: added example header and space
chalmerlowe May 15, 2018
b0977f4
DOC: fixed minor spelling error
chalmerlowe May 15, 2018
85bcb52
removed trailing whitespace, long lines
chalmerlowe May 16, 2018
841611e
Merge remote-tracking branch 'upstream/master' into nanosecond-docstring
chalmerlowe May 16, 2018
4237391
DOC: updates to docstring for nanoseconds function per doc guidelines
chalmerlowe May 16, 2018
5035798
DOC: documentation guide update to resolution docstring
chalmerlowe May 17, 2018
3de9d58
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
chalmerlowe May 18, 2018
23a8aae
DOC: Improve docstring of Timedelta.resolution
chalmerlowe May 18, 2018
2c91847
DOC: Improve docstring of Timedelta.resolution
chalmerlowe May 18, 2018
83da2fe
DOC: Improve the docstring of Timedelta.resolution
chalmerlowe May 18, 2018
764f91a
DOC: Improve the docstring of Timedelta.resolution
chalmerlowe May 19, 2018
886f21a
Minor edits as suggested
chalmerlowe May 19, 2018
5737c67
DOC: Improve the docstring of Timedelta.resolution
chalmerlowe Jul 7, 2018
bf0def0
Merge remote-tracking branch 'upstream/master' into resolution-docstring
chalmerlowe Jul 7, 2018
1d0d397
Merge remote-tracking branch 'upstream/master' into resolution-docstring
Jul 7, 2018
ce7c795
remove whitespace
Jul 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,53 @@ cdef class _Timedelta(timedelta):

@property
def resolution(self):
""" return a string representing the lowest resolution that we have """
"""
Return a string representing the lowest (i.e. smallest) time
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

resolution.

Each timedelta has a defined resolution that represents the lowest OR
most granular level of precision. Each level of resolution is
represented by a short string as defined below:

============ ============
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this will render in a doc-string, not really sure what the standard is for a table like list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a suggestion?
Do bulleted lists work?

          - Days:         'D'	
          - Hours:        'H'	
          - Minutes:      'T'	
          - Seconds:      'S'	
          - Milliseconds: 'L'	
          - Microseconds: 'U'	
          - Nanoseconds:  'N'

Copy link
Contributor

Choose a reason for hiding this comment

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

yep that's prob ok

Resolution Return value
============ ============
Days 'D'
Hours 'H'
Minutes 'T'
Seconds 'S'
Milliseconds 'L'
Microseconds 'U'
Nanoseconds 'N'
============ ============

Returns
-------
str
Time resolution.
Copy link
Contributor

Choose a reason for hiding this comment

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

Time -> Timedelta


Examples
--------
**Using string input**
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the 'Using string input' or numeric input section


>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')
>>> td.resolution
'N'

>>> td = pd.Timedelta('1 days 2 min 3 us')
>>> td.resolution
'U'

>>> td = pd.Timedelta('2 min 3 s')
>>> td.resolution
'S'

**Using integer input**

>>> td = pd.Timedelta(36, unit='us')
>>> td.resolution
'U'
"""

self._ensure_components()
if self._ns:
Expand Down