Skip to content

Commit 3458d3d

Browse files
committed
BUG: PeriodIndex fails to handle NA, rather than putting NaT in its place (pandas-dev#46673)
1 parent caa4a83 commit 3458d3d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ from cpython.datetime cimport (
2828

2929
import_datetime()
3030

31+
3132
cimport pandas._libs.tslibs.util as util
3233
from pandas._libs.tslibs.base cimport ABCTimestamp
3334
from pandas._libs.tslibs.conversion cimport (

pandas/tests/arrays/categorical/test_indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_periodindex_on_null_types(self, null_val):
206206
# GH 46673
207207
result = PeriodIndex(["2022-04-06", "2022-04-07", null_val], freq="D")
208208
expected = PeriodIndex(["2022-04-06", "2022-04-07", "NaT"], dtype="period[D]")
209-
assert type(result[2]) == type(NaT)
209+
assert result[2] is NaT
210210
tm.assert_index_equal(result, expected)
211211

212212
@pytest.mark.parametrize("new_categories", [[1, 2, 3, 4], [1, 2]])

0 commit comments

Comments
 (0)