You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/user_guide/timedeltas.rst
+9-8
Original file line number
Diff line number
Diff line change
@@ -236,9 +236,7 @@ Numeric reduction operation for ``timedelta64[ns]`` will return ``Timedelta`` ob
236
236
Frequency conversion
237
237
--------------------
238
238
239
-
Timedelta Series, ``TimedeltaIndex``, and ``Timedelta`` scalars can be converted to other 'frequencies' by dividing by another timedelta,
240
-
or by astyping to a specific timedelta type. These operations yield Series and propagate ``NaT`` -> ``nan``.
241
-
Note that division by the NumPy scalar is true division, while astyping is equivalent of floor division.
239
+
Timedelta Series and ``TimedeltaIndex``, and ``Timedelta`` can be converted to other frequencies by astyping to a specific timedelta dtype.
242
240
243
241
.. ipython:: python
244
242
@@ -250,14 +248,17 @@ Note that division by the NumPy scalar is true division, while astyping is equiv
250
248
td[3] = np.nan
251
249
td
252
250
253
-
# to days
254
-
td / np.timedelta64(1, "D")
255
-
td.astype("timedelta64[D]")
256
-
257
251
# to seconds
258
-
td / np.timedelta64(1, "s")
259
252
td.astype("timedelta64[s]")
260
253
254
+
For timedelta64 resolutions other than the supported "s", "ms", "us", "ns",
255
+
an alternative is to divide by another timedelta object. Note that division by the NumPy scalar is true division, while astyping is equivalent of floor division.
0 commit comments