Skip to content

DOC: fix PR09,PR08 doc string errors in Timestamp, NaT, Timedelta class #28674

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 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f3d45aa
DOC: fix PR09 doc string errors in Timestamp class
Sep 29, 2019
a4ee42b
fix docstrings for Timestamp, NaT classes
Sep 29, 2019
70703e1
fix unit description in Timedelta
Sep 29, 2019
59f29e7
DOC: fix PR09 doc string errors in Timestamp class
Sep 29, 2019
b58af1a
fix docstrings for Timestamp, NaT classes
Sep 29, 2019
5b99c06
fix unit description in Timedelta
Sep 29, 2019
e3eb09e
change ambiguous param args and remove period
Oct 1, 2019
aa5bae2
fix merge conflict
Oct 1, 2019
776451e
CLN: Assorted typings (#28604)
jbrockmendel Oct 1, 2019
962140f
remove periods after versionadd and fix deprecated directive
Oct 1, 2019
225d5e2
DOC: Fixed PR08 docstring errors in pandas.tseries (#28571)
jb8429 Oct 1, 2019
4661d77
DOC: Add scaling to large datasets section (#28577)
TomAugspurger Oct 1, 2019
c9b6f83
BUG: restore limit in RangeIndex.get_indexer (#28671)
charlesdong1991 Oct 1, 2019
d68e9fb
DOC: Fixed PR09 docstring errors in pandas.tseries (#27977) (#28707)
ladyyvii Oct 1, 2019
2ad3704
CI Failing: TestReadHtml.test_spam_url #28708 (#28710)
ladyyvii Oct 1, 2019
5ec718a
TST: un-xfail incorrectly xfailed tests for maybe_promote (#28564)
jbrockmendel Oct 1, 2019
dc67804
CLN: Define and pin GroupBy properties without exec (#28651)
jbrockmendel Oct 1, 2019
c794bbf
DOC: Fixed PR08, PR09 doctring issues in pandas.core.groupby (#28709)
dayoreke Oct 1, 2019
4e371c1
DOC: Fixed PR06 docstring errors in pandas.DataFrame (#28718)
LauraCollard Oct 1, 2019
21f6505
DOC: Fixed PR06 docstrings errors in pandas.arrays.IntervalArray (#28…
LauraCollard Oct 1, 2019
7e05957
DOC: fix PR09,PR08 docstring errors in pandas.plotting (#28689)
Oct 1, 2019
dd028fd
precursor to Split out test_pytables.py to sub-module of tests (#28715)
tolaa001 Oct 1, 2019
c5bc928
fix merge conflict
Oct 1, 2019
8bcda1d
Merge remote-tracking branch 'upstream/master' into PR09-Timestamp-fix
Oct 1, 2019
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
166 changes: 91 additions & 75 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class NaTType(_NaT):
Parameters
----------
locale : string, default None (English locale)
locale determining the language in which to return the month name
Locale determining the language in which to return the month name.

Returns
-------
Expand All @@ -411,7 +411,7 @@ class NaTType(_NaT):
Parameters
----------
locale : string, default None (English locale)
locale determining the language in which to return the day name
Locale determining the language in which to return the day name.

Returns
-------
Expand Down Expand Up @@ -509,11 +509,11 @@ class NaTType(_NaT):
Parameters
----------
ordinal : int
date corresponding to a proleptic Gregorian ordinal
Date corresponding to a proleptic Gregorian ordinal.
freq : str, DateOffset
Offset which Timestamp will have
Offset to apply to the Timestamp.
tz : str, pytz.timezone, dateutil.tz.tzfile or None
Time zone for time which Timestamp will have.
Time zone for the Timestamp.
""")

# _nat_methods
Expand All @@ -534,7 +534,7 @@ class NaTType(_NaT):
Parameters
----------
tz : str or timezone object, default None
Timezone to localize to
Timezone to localize to.
""")
today = _make_nat_func('today', # noqa:E128
"""
Expand All @@ -547,35 +547,38 @@ class NaTType(_NaT):
Parameters
----------
tz : str or timezone object, default None
Timezone to localize to
Timezone to localize to.
""")
round = _make_nat_func('round', # noqa:E128
"""
Round the Timestamp to the specified resolution.

Parameters
----------
freq : a freq string indicating the rounding resolution
ambiguous : bool, 'NaT', default 'raise'
- bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates)
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
freq : str
Frequency string indicating the rounding resolution.
ambiguous : bool or {'raise', 'NaT'}, default 'raise'
The behavior is as follows:

* bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates).
* 'NaT' will return NaT for an ambiguous time.
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
timedelta}, default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

- 'shift_forward' will shift the nonexistent time forward to the
closest existing time
- 'shift_backward' will shift the nonexistent time backward to the
closest existing time
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
* 'shift_forward' will shift the nonexistent time forward to the
closest existing time.
* 'shift_backward' will shift the nonexistent time backward to the
closest existing time.
* 'NaT' will return NaT where there are nonexistent times.
* timedelta objects will shift nonexistent times by the timedelta.
* 'raise' will raise an NonExistentTimeError if there are
nonexistent times.

.. versionadded:: 0.24.0

Expand All @@ -585,75 +588,81 @@ default 'raise'

Raises
------
ValueError if the freq cannot be converted
ValueError if the freq cannot be converted.
""")
floor = _make_nat_func('floor', # noqa:E128
"""
return a new Timestamp floored to this resolution.

Parameters
----------
freq : a freq string indicating the flooring resolution
ambiguous : bool, 'NaT', default 'raise'
- bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates)
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
freq : str
Frequency string indicating the flooring resolution.
ambiguous : bool or {'raise', 'NaT'}, default 'raise'
The behavior is as follows:

* bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates).
* 'NaT' will return NaT for an ambiguous time.
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
timedelta}, default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

- 'shift_forward' will shift the nonexistent time forward to the
closest existing time
- 'shift_backward' will shift the nonexistent time backward to the
closest existing time
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
* 'shift_forward' will shift the nonexistent time forward to the
closest existing time.
* 'shift_backward' will shift the nonexistent time backward to the
closest existing time.
* 'NaT' will return NaT where there are nonexistent times.
* timedelta objects will shift nonexistent times by the timedelta.
* 'raise' will raise an NonExistentTimeError if there are
nonexistent times.

.. versionadded:: 0.24.0

Raises
------
ValueError if the freq cannot be converted
ValueError if the freq cannot be converted.
""")
ceil = _make_nat_func('ceil', # noqa:E128
"""
return a new Timestamp ceiled to this resolution.

Parameters
----------
freq : a freq string indicating the ceiling resolution
ambiguous : bool, 'NaT', default 'raise'
- bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates)
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
freq : str
Frequency string indicating the ceiling resolution.
ambiguous : bool or {'raise', 'NaT'}, default 'raise'
The behavior is as follows:

* bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates).
* 'NaT' will return NaT for an ambiguous time.
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
timedelta}, default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

- 'shift_forward' will shift the nonexistent time forward to the
closest existing time
- 'shift_backward' will shift the nonexistent time backward to the
closest existing time
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
* 'shift_forward' will shift the nonexistent time forward to the
closest existing time.
* 'shift_backward' will shift the nonexistent time backward to the
closest existing time.
* 'NaT' will return NaT where there are nonexistent times.
* timedelta objects will shift nonexistent times by the timedelta.
* 'raise' will raise an NonExistentTimeError if there are
nonexistent times.

.. versionadded:: 0.24.0

Raises
------
ValueError if the freq cannot be converted
ValueError if the freq cannot be converted.
""")

tz_convert = _make_nat_func('tz_convert', # noqa:E128
Expand Down Expand Up @@ -694,32 +703,39 @@ default 'raise'
`ambiguous` parameter dictates how ambiguous times should be
handled.

- bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates)
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
The behavior is as follows:

* bool contains flags to determine if time is dst or not (note
that this flag is only applicable for ambiguous fall dst dates).
* 'NaT' will return NaT for an ambiguous time.
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

- 'shift_forward' will shift the nonexistent time forward to the
closest existing time
- 'shift_backward' will shift the nonexistent time backward to the
closest existing time
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
The behavior is as follows:

.. versionadded:: 0.24.0
* 'shift_forward' will shift the nonexistent time forward to the
closest existing time.
* 'shift_backward' will shift the nonexistent time backward to the
closest existing time.
* 'NaT' will return NaT where there are nonexistent times.
* timedelta objects will shift nonexistent times by the timedelta.
* 'raise' will raise an NonExistentTimeError if there are
nonexistent times.

.. versionadded:: 0.24.0
errors : 'raise', 'coerce', default None
- 'raise' will raise a NonExistentTimeError if a timestamp is not
valid in the specified timezone (e.g. due to a transition from
or to DST time). Use ``nonexistent='raise'`` instead.
- 'coerce' will return NaT if the timestamp can not be converted
Determine how errors should be handled.

The behavior is as follows:

* 'raise' will raise a NonExistentTimeError if a timestamp is not
valid in the specified timezone (e.g. due to a transition from
or to DST time). Use ``nonexistent='raise'`` instead.
* 'coerce' will return NaT if the timestamp can not be converted
into the specified timezone. Use ``nonexistent='NaT'`` instead.

.. deprecated:: 0.24.0
Expand Down
11 changes: 7 additions & 4 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ class Timedelta(_Timedelta):
'm', 'minute', 'min', 'minutes', 'T', 'S', 'seconds', 'sec', 'second',
'ms', 'milliseconds', 'millisecond', 'milli', 'millis', 'L',
'us', 'microseconds', 'microsecond', 'micro', 'micros', 'U',
'ns', 'nanoseconds', 'nano', 'nanos', 'nanosecond', 'N'}
'ns', 'nanoseconds', 'nano', 'nanos', 'nanosecond', 'N'}.
**kwargs
Available kwargs: {days, seconds, microseconds,
milliseconds, minutes, hours, weeks}.
Expand Down Expand Up @@ -1323,7 +1323,8 @@ class Timedelta(_Timedelta):

Parameters
----------
freq : a freq string indicating the rounding resolution
freq : str
Frequency string indicating the rounding resolution.

Returns
-------
Expand All @@ -1341,7 +1342,8 @@ class Timedelta(_Timedelta):

Parameters
----------
freq : a freq string indicating the flooring resolution
freq : str
Frequency string indicating the flooring resolution.
"""
return self._round(freq, np.floor)

Expand All @@ -1351,7 +1353,8 @@ class Timedelta(_Timedelta):

Parameters
----------
freq : a freq string indicating the ceiling resolution
freq : str
Frequency string indicating the ceiling resolution.
"""
return self._round(freq, np.ceil)

Expand Down
Loading