Skip to content

Commit ca6c0fd

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

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pandas/_libs/tslibs/period.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ from pandas._libs.tslibs.timedeltas cimport (
7272

7373
from pandas._libs.tslibs.conversion import DT64NS_DTYPE
7474

75+
from pandas._libs.missing cimport C_NA
7576
from pandas._libs.tslibs.dtypes cimport (
7677
FR_ANN,
7778
FR_BUS,

pandas/tests/extension/test_arrow.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ def test_combine_le(self, data_repeated):
15871587

15881588
def test_combine_add(self, data_repeated, request):
15891589
pa_dtype = next(data_repeated(1)).dtype.pyarrow_dtype
1590-
if pa.types.is_temporal(pa_dtype) and pa_dtype != "duration[ns]":
1590+
if pa.types.is_temporal(pa_dtype):
15911591
request.node.add_marker(
15921592
pytest.mark.xfail(
15931593
raises=TypeError,
@@ -1697,7 +1697,7 @@ def test_arith_series_with_scalar(
16971697
elif arrow_temporal_supported:
16981698
request.node.add_marker(
16991699
pytest.mark.xfail(
1700-
raises=TypeError if pa_dtype != "duration[ns]" else AssertionError,
1700+
raises=TypeError,
17011701
reason=(
17021702
f"{all_arithmetic_operators} not supported between"
17031703
f"pd.NA and {pa_dtype} Python scalar"
@@ -1763,7 +1763,7 @@ def test_arith_frame_with_scalar(
17631763
elif arrow_temporal_supported:
17641764
request.node.add_marker(
17651765
pytest.mark.xfail(
1766-
raises=TypeError if pa_dtype != "duration[ns]" else AssertionError,
1766+
raises=TypeError,
17671767
reason=(
17681768
f"{all_arithmetic_operators} not supported between"
17691769
f"pd.NA and {pa_dtype} Python scalar"
@@ -1847,7 +1847,7 @@ def test_arith_series_with_array(
18471847
elif arrow_temporal_supported:
18481848
request.node.add_marker(
18491849
pytest.mark.xfail(
1850-
raises=TypeError if pa_dtype != "duration[ns]" else AssertionError,
1850+
raises=TypeError,
18511851
reason=(
18521852
f"{all_arithmetic_operators} not supported between"
18531853
f"pd.NA and {pa_dtype} Python scalar"

0 commit comments

Comments
 (0)