Skip to content

Commit 4be6817

Browse files
committed
Removed PeriodArray special casing and modified test case
1 parent 801b39e commit 4be6817

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

pandas/core/frame.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8450,8 +8450,6 @@ def _maybe_align_series_as_frame(self, series: Series, axis: AxisInt):
84508450
blockwise.
84518451
"""
84528452
rvalues = series._values
8453-
if isinstance(rvalues, PeriodArray):
8454-
return series
84558453
if not isinstance(rvalues, np.ndarray):
84568454
if axis == 0:
84578455
df = DataFrame(dict.fromkeys(range(self.shape[1]), rvalues))

pandas/tests/arithmetic/test_period.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,16 +1371,11 @@ def test_period_add_timestamp_raises(self, box_with_array):
13711371
with pytest.raises(TypeError, match=msg):
13721372
pd.Index([ts]) + arr
13731373

1374-
if box_with_array is pd.DataFrame:
1375-
msg = "cannot add PeriodArray and DatetimeArray"
1376-
else:
1377-
msg = r"unsupported operand type\(s\) for \+: 'Period' and 'DatetimeArray"
1374+
msg = "cannot add PeriodArray and DatetimeArray"
1375+
13781376
with pytest.raises(TypeError, match=msg):
13791377
arr + pd.DataFrame([ts])
1380-
if box_with_array is pd.DataFrame:
1381-
msg = "cannot add PeriodArray and DatetimeArray"
1382-
else:
1383-
msg = r"unsupported operand type\(s\) for \+: 'DatetimeArray' and 'Period'"
1378+
13841379
with pytest.raises(TypeError, match=msg):
13851380
pd.DataFrame([ts]) + arr
13861381

0 commit comments

Comments
 (0)