Skip to content

Commit 5569fd9

Browse files
committed
DOC: Add experimental note to DatetimeArray and TimedeltaArray
DOC: Mention PeriodArray and IntervalArray Closes #24870
1 parent c588437 commit 5569fd9

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

doc/source/whatsnew/v0.24.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ from the ``Series``:
210210
ser.array
211211
pser.array
212212
213+
These return an instance of :class:`IntervalArray` or :class:`arrays.PeriodArray`,
214+
the new extension arrays that back interval and period data.
215+
213216
.. warning::
214217

215218
For backwards compatibility, :attr:`Series.values` continues to return

pandas/core/arrays/datetimes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ class DatetimeArray(dtl.DatetimeLikeArrayMixin,
218218
219219
.. versionadded:: 0.24.0
220220
221+
.. warning::
222+
223+
DatetimeArray is currently experimental, and its API may change
224+
without warning. In particular, :meth:`DatetimeArray.dtype` is
225+
expected to change to always be an ``ExtensionDtype``.
226+
221227
Parameters
222228
----------
223229
values : Series, Index, DatetimeArray, ndarray
@@ -511,6 +517,12 @@ def dtype(self):
511517
"""
512518
The dtype for the DatetimeArray.
513519
520+
.. warning::
521+
522+
A future version of pandas will change dtype to never be a
523+
``numpy.dtype``. Instead it will always be a subclass of
524+
:class:`pandas.api.extensions.ExtensionDtype`.
525+
514526
Returns
515527
-------
516528
numpy.dtype or DatetimeTZDtype

pandas/core/arrays/timedeltas.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,28 @@ def wrapper(self, other):
107107

108108

109109
class TimedeltaArray(dtl.DatetimeLikeArrayMixin, dtl.TimelikeOps):
110+
"""
111+
Pandas ExtensionArray for timedelta data.
112+
113+
.. versionadded :: 0.24.0
114+
115+
.. warning::
116+
117+
TimedeltaArray is currently experimental, and its API may change
118+
without warning. In particular, :meth:`TimedeltaArray.dtype` is
119+
expected to change to be an ``ExtensionDtype``.
120+
121+
Parameters
122+
----------
123+
values : array-like
124+
The timedelta data.
125+
126+
dtype : numpy.dtype
127+
Currently, only ``numpy.dtype("timedelta64[ns]")`` is accepted.
128+
freq : Offset, optional
129+
copy : bool, default False
130+
Whether to copy the underlying array of data.
131+
"""
110132
_typ = "timedeltaarray"
111133
_scalar_type = Timedelta
112134
__array_priority__ = 1000
@@ -128,6 +150,19 @@ def _box_func(self):
128150

129151
@property
130152
def dtype(self):
153+
"""
154+
The dtype for the TimedeltaArray.
155+
156+
.. warning::
157+
158+
A future version of pandas will change dtype to be an instance
159+
of a :class:`pandas.api.extensions.ExtensionDtype` subclass,
160+
not a ``numpy.dtype``.
161+
162+
Returns
163+
-------
164+
numpy.dtype
165+
"""
131166
return _TD_DTYPE
132167

133168
# ----------------------------------------------------------------

0 commit comments

Comments
 (0)