Skip to content
Merged
Changes from all commits
Commits
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
37 changes: 32 additions & 5 deletions doc/source/whatsnew/v0.13.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ Enhancements
is frequency conversion. See :ref:`the docs<timedeltas.timedeltas_convert>` for the docs.

.. ipython:: python
:okexcept:

import datetime
td = pd.Series(pd.date_range('20130101', periods=4)) - pd.Series(
Expand All @@ -546,13 +545,41 @@ Enhancements
td[3] = np.nan
td

.. code-block:: ipython

# to days
td / np.timedelta64(1, 'D')
td.astype('timedelta64[D]')
In [63]: td / np.timedelta64(1, 'D')
Out[63]:
0 31.000000
1 31.000000
2 31.003507
3 NaN
dtype: float64

In [64]: td.astype('timedelta64[D]')
Out[64]:
0 31.0
1 31.0
2 31.0
3 NaN
dtype: float64

# to seconds
td / np.timedelta64(1, 's')
td.astype('timedelta64[s]')
In [65]: td / np.timedelta64(1, 's')
Out[65]:
0 2678400.0
1 2678400.0
2 2678703.0
3 NaN
dtype: float64

In [66]: td.astype('timedelta64[s]')
Out[66]:
0 2678400.0
1 2678400.0
2 2678703.0
3 NaN
dtype: float64

Dividing or multiplying a ``timedelta64[ns]`` Series by an integer or integer Series

Expand Down