Skip to content

Commit 0650c0b

Browse files
authored
TST closes #28980 Certain comparison operations misbehaving for period dtype (#34417)
1 parent ce29248 commit 0650c0b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/arithmetic/test_period.py

+8
Original file line numberDiff line numberDiff line change
@@ -1522,3 +1522,11 @@ def test_pi_sub_period_nat(self):
15221522
exp = pd.TimedeltaIndex([np.nan, np.nan, np.nan, np.nan], name="idx")
15231523
tm.assert_index_equal(idx - pd.Period("NaT", freq="M"), exp)
15241524
tm.assert_index_equal(pd.Period("NaT", freq="M") - idx, exp)
1525+
1526+
@pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None])
1527+
def test_comparison_operations(self, scalars):
1528+
# GH 28980
1529+
expected = Series([False, False])
1530+
s = Series([pd.Period("2019"), pd.Period("2020")], dtype="period[A-DEC]")
1531+
result = s == scalars
1532+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)