-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Add linspace range behavior to the timeseries/timedeltas/interval docs #21114
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,7 +353,7 @@ TimedeltaIndex | |
-------------- | ||
|
||
To generate an index with time delta, you can use either the ``TimedeltaIndex`` or | ||
the ``timedelta_range`` constructor. | ||
the :func:`timedelta_range` constructor. | ||
|
||
Using ``TimedeltaIndex`` you can pass string-like, ``Timedelta``, ``timedelta``, | ||
or ``np.timedelta64`` objects. Passing ``np.nan/pd.NaT/nat`` will represent missing values. | ||
|
@@ -363,13 +363,44 @@ or ``np.timedelta64`` objects. Passing ``np.nan/pd.NaT/nat`` will represent miss | |
pd.TimedeltaIndex(['1 days', '1 days, 00:00:05', | ||
np.timedelta64(2,'D'), datetime.timedelta(days=2,seconds=2)]) | ||
|
||
Similarly to ``date_range``, you can construct regular ranges of a ``TimedeltaIndex``: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe make a sub-section here |
||
Similar to ``date_range``, you can construct regular ranges of a ``TimedeltaIndex`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add |
||
using ``timedelta_range``. The default frequency for ``timedelta_range`` is | ||
calendar day: | ||
|
||
.. ipython:: python | ||
|
||
pd.timedelta_range(start='1 days', periods=5) | ||
|
||
Various combinations of ``start``, ``end``, and ``periods`` can be used with | ||
``timedelta_range``: | ||
|
||
.. ipython:: python | ||
|
||
pd.timedelta_range(start='1 days', end='5 days') | ||
|
||
pd.timedelta_range( end='10 days', periods=4) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small nit: There's an extra space between the left parenthesis and end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, fixed |
||
|
||
The ``freq`` parameter can passed a variety of :ref:`frequency aliases <timeseries.offset_aliases>`: | ||
|
||
.. ipython:: python | ||
|
||
pd.timedelta_range(start='1 days', periods=5, freq='D') | ||
pd.timedelta_range(start='1 days', end='2 days', freq='30T') | ||
|
||
pd.timedelta_range(start='1 days', periods=5, freq='2D5H') | ||
|
||
|
||
.. versionadded:: 0.23.0 | ||
|
||
Specifying ``start``, ``end``, and ``periods`` will generate a range of evenly spaced | ||
timedeltas from ``start`` to ``end`` inclusively, with ``periods`` number of elements | ||
in the resulting ``TimedeltaIndex``: | ||
|
||
.. ipython:: python | ||
|
||
pd.timedelta_range('0 days', '4 days', periods=5) | ||
|
||
pd.timedelta_range('0 days', '4 days', periods=10) | ||
|
||
Using the TimedeltaIndex | ||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a sub-section here