Skip to content

Commit 0a9a542

Browse files
committed
Comply with pre-commit and added an entry in v3.0.0.rst
1 parent cf1cd0d commit 0a9a542

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ Datetimelike
644644
- Bug in :func:`date_range` where using a negative frequency value would not include all points between the start and end values (:issue:`56147`)
645645
- Bug in :func:`tseries.api.guess_datetime_format` would fail to infer time format when "%Y" == "%H%M" (:issue:`57452`)
646646
- Bug in :func:`tseries.frequencies.to_offset` would fail to parse frequency strings starting with "LWOM" (:issue:`59218`)
647+
- Bug in :meth:`DataFrame.fillna` raising an ``AssertionError`` instead of ``OutOfBoundsDatetime`` when filling a ``datetime64[ns]`` column with an out-of-bounds timestamp. Now correctly raises ``OutOfBoundsDatetime``. (:issue:`61208`)
647648
- Bug in :meth:`DataFrame.min` and :meth:`DataFrame.max` casting ``datetime64`` and ``timedelta64`` columns to ``float64`` and losing precision (:issue:`60850`)
648649
- Bug in :meth:`Dataframe.agg` with df with missing values resulting in IndexError (:issue:`58810`)
649650
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)

pandas/core/internals/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ def putmask(self, mask, new) -> list[Block]:
17491749
try:
17501750
# Caller is responsible for ensuring matching lengths
17511751
values._putmask(mask, new)
1752-
except OutOfBoundsDatetime as e:
1752+
except OutOfBoundsDatetime:
17531753
raise
17541754
except (TypeError, ValueError):
17551755
if self.ndim == 1 or self.shape[0] == 1:

pandas/tests/frame/methods/test_fillna.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.errors import OutOfBoundsDatetime
5+
46
from pandas import (
57
Categorical,
68
DataFrame,
@@ -15,7 +17,6 @@
1517
)
1618
import pandas._testing as tm
1719
from pandas.tests.frame.common import _check_mixed_float
18-
from pandas.errors import OutOfBoundsDatetime
1920

2021

2122
class TestFillNA:
@@ -782,19 +783,15 @@ def test_fillna_with_none_object(test_frame, dtype):
782783
if test_frame:
783784
expected = expected.to_frame()
784785
tm.assert_equal(result, expected)
785-
786-
786+
787+
787788
def test_fillna_out_of_bounds_datetime():
788789
# GH#61208
789-
df = DataFrame({
790-
'datetime': date_range('1/1/2011', periods=3, freq='h'),
791-
'value': [1, 2, 3]
792-
})
790+
df = DataFrame(
791+
{"datetime": date_range("1/1/2011", periods=3, freq="h"), "value": [1, 2, 3]}
792+
)
793793
df.iloc[0, 0] = None
794794

795-
msg="Cannot cast 0001-01-01 00:00:00 to unit='ns' without overflow"
796-
with pytest.raises(
797-
OutOfBoundsDatetime,
798-
match=msg
799-
):
800-
df.fillna(Timestamp('0001-01-01'), inplace=True)
795+
msg = "Cannot cast 0001-01-01 00:00:00 to unit='ns' without overflow"
796+
with pytest.raises(OutOfBoundsDatetime, match=msg):
797+
df.fillna(Timestamp("0001-01-01"), inplace=True)

0 commit comments

Comments
 (0)