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/whatsnew/v0.15.0.txt
+15-7
Original file line number
Diff line number
Diff line change
@@ -111,16 +111,25 @@ This type is very similar to how ``Timestamp`` works for ``datetimes``. It is a
111
111
112
112
``Timedelta`` scalars (and ``TimedeltaIndex``) component fields are *not the same* as the component fields on a ``datetime.timedelta`` object. For example, ``.seconds`` on a ``datetime.timedelta`` object returns the total number of seconds combined between ``hours``, ``minutes`` and ``seconds``. In contrast, the pandas ``Timedelta`` breaks out hours, minutes, microseconds and nanoseconds separately.
113
113
114
-
.. ipython:: python
114
+
.. code-block:: python
115
115
116
116
# Timedelta accessor
117
-
tds = Timedelta('31 days 5 min 3 sec')
118
-
tds.minutes
119
-
tds.seconds
117
+
In [9]: tds = Timedelta('31 days 5 min 3 sec')
118
+
119
+
In [10]: tds.minutes
120
+
Out[10]: 5L
121
+
122
+
In [11]: tds.seconds
123
+
Out[11]: 3L
120
124
121
125
# datetime.timedelta accessor
122
126
# this is 5 minutes * 60 + 3 seconds
123
-
tds.to_pytimedelta().seconds
127
+
In [12]: tds.to_pytimedelta().seconds
128
+
Out[12]: 303
129
+
130
+
**Note**: this is no longer true starting from v0.16.0, where full
131
+
compatibility with ``datetime.timedelta`` is introduced. See the
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.16.0.txt
+20-5
Original file line number
Diff line number
Diff line change
@@ -22,14 +22,29 @@ New features
22
22
23
23
.. _whatsnew_0160.api:
24
24
25
-
Backwards incompatible API changes
26
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
-
28
25
.. _whatsnew_0160.api_breaking:
29
26
30
-
- In v0.15.0 a new scalar type ``Timedelta`` was introduced, that is a sub-class of ``datetime.timedelta``. Mentioned :ref:`here <whatsnew_0150.timedeltaindex>` was a notice of an API change w.r.t. the ``.seconds`` accessor. The intent was to provide a user-friendly set of accessors that give the 'natural' value for that unit, e.g. if you had a ``Timedelta('1 day, 10:11:12')``, then ``.seconds`` would return 12. However, this is at odds with the definition of ``datetime.timedelta``, which defines ``.seconds`` as ``10 * 3600 + 11 * 60 + 12 == 36672``.
27
+
Backwards incompatible API changes
28
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
29
32
-
So in v0.16.0, we are restoring the API to match that of ``datetime.timedelta``. Further, the component values are still available through the ``.components`` accessor. This affects the ``.seconds`` and ``.microseconds`` accessors, and removes the ``.hours``, ``.minutes``, ``.milliseconds`` accessors. These changes affect ``TimedeltaIndex`` and the Series ``.dt`` accessor as well. (:issue:`9185`, :issue:`9139`)
30
+
.. _whatsnew_0160.api_breaking.timedelta:
31
+
32
+
- In v0.15.0 a new scalar type ``Timedelta`` was introduced, that is a
33
+
sub-class of ``datetime.timedelta``.
34
+
Mentioned :ref:`here <whatsnew_0150.timedeltaindex>` was a notice of an API
35
+
change w.r.t. the ``.seconds`` accessor. The intent was to provide a
36
+
user-friendly set of accessors that give the 'natural' value for that unit,
37
+
e.g. if you had a ``Timedelta('1 day, 10:11:12')``, then ``.seconds`` would
38
+
return 12. However, this is at odds with the definition of
39
+
``datetime.timedelta``, which defines ``.seconds`` as
40
+
``10 * 3600 + 11 * 60 + 12 == 36672``.
41
+
42
+
So in v0.16.0, we are restoring the API to match that of
43
+
``datetime.timedelta``. Further, the component values are still available
44
+
through the ``.components`` accessor. This affects the ``.seconds`` and
45
+
``.microseconds`` accessors, and removes the ``.hours``, ``.minutes``,
46
+
``.milliseconds`` accessors. These changes affect ``TimedeltaIndex``
47
+
and the Series ``.dt`` accessor as well. (:issue:`9185`, :issue:`9139`)
0 commit comments