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
Adding or subtracting ``NaN`` from a :class:`DataFrame` column with
416
+
`timedelta64[ns]` dtype will now raise a ``TypeError`` instead of returning
417
+
all-``NaT``. This is for compatibility with ``TimedeltaIndex`` and
418
+
``Series`` behavior (:issue:`22163`)
419
+
420
+
.. ipython:: python
421
+
422
+
df = pd.DataFrame([pd.Timedelta(days=1)])
423
+
df - np.nan
424
+
425
+
Previous Behavior:
426
+
427
+
.. code-block:: ipython
428
+
429
+
In [4]: df = pd.DataFrame([pd.Timedelta(days=1)])
430
+
431
+
In [5]: df - np.nan
432
+
Out[5]:
433
+
0
434
+
0 NaT
435
+
436
+
409
437
.. _whatsnew_0240.api.extension:
410
438
411
439
ExtensionType Changes
@@ -539,6 +567,16 @@ Datetimelike
539
567
- Bug in :class:`DatetimeIndex` comparisons where string comparisons incorrectly raises ``TypeError`` (:issue:`22074`)
540
568
- Bug in :class:`DatetimeIndex` comparisons when comparing against ``timedelta64[ns]`` dtyped arrays; in some cases ``TypeError`` was incorrectly raised, in others it incorrectly failed to raise (:issue:`22074`)
541
569
- Bug in :class:`DatetimeIndex` comparisons when comparing against object-dtyped arrays (:issue:`22074`)
570
+
- Bug in :class:`DataFrame` with ``datetime64[ns]`` dtype addition and subtraction with ``Timedelta``-like objects (:issue:`22005`,:issue:`22163`)
571
+
- Bug in :class:`DataFrame` with ``datetime64[ns]`` dtype addition and subtraction with ``DateOffset`` objects returning an ``object`` dtype instead of ``datetime64[ns]`` dtype (:issue:`21610`,:issue:`22163`)
572
+
- Bug in :class:`DataFrame` with ``datetime64[ns]`` dtype comparing against ``NaT`` incorrectly (:issue:`22242`,:issue:`22163`)
573
+
- Bug in :class:`DataFrame` with ``datetime64[ns]`` dtype subtracting ``Timestamp``-like object incorrectly returned ``datetime64[ns]`` dtype instead of ``timedelta64[ns]`` dtype (:issue:`8554`,:issue:`22163`)
574
+
- Bug in :class:`DataFrame` with ``datetime64[ns]`` dtype subtracting ``np.datetime64`` object with non-nanosecond unit failing to convert to nanoseconds (:issue:`18874`,:issue:`22163`)
575
+
- Bug in :class:`DataFrame` comparisons against ``Timestamp``-like objects failing to raise ``TypeError`` for inequality checks with mismatched types (:issue:`8932`,:issue:`22163`)
576
+
- Bug in :class:`DataFrame` with mixed dtypes including ``datetime64[ns]`` incorrectly raising ``TypeError`` on equality comparisons (:issue:`13128`,:issue:`22163`)
577
+
- Bug in :meth:`DataFrame.eq` comparison against ``NaT`` incorrectly returning ``True`` or ``NaN`` (:issue:`15697`,:issue:`22163`)
578
+
- Bug in :class:`DataFrame` with ``timedelta64[ns]`` dtype division by ``Timedelta``-like scalar incorrectly returning ``timedelta64[ns]`` dtype instead of ``float64`` dtype (:issue:`20088`,:issue:`22163`)
579
+
-
542
580
543
581
Timedelta
544
582
^^^^^^^^^
@@ -586,6 +624,7 @@ Numeric
586
624
when supplied with a list of functions and ``axis=1`` (e.g. ``df.apply(['sum', 'mean'], axis=1)``),
587
625
a ``TypeError`` was wrongly raised. For all three methods such calculation are now done correctly. (:issue:`16679`).
588
626
- Bug in :class:`Series` comparison against datetime-like scalars and arrays (:issue:`22074`)
627
+
- Bug in :class:`DataFrame` multiplication between boolean dtype and integer returning ``object`` dtype instead of integer dtype (:issue:`22047`,:issue:`22163`)
0 commit comments