Skip to content

Commit d49cbc0

Browse files
committed
Handle empty case
1 parent 7fea8d7 commit d49cbc0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: pandas/core/indexes/period.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,11 @@ def shift(self, periods: int = 1, freq=None) -> Self:
535535
return self + periods
536536

537537
def _convert_can_do_setop(self, other):
538-
if not isinstance(other, Index) or isinstance(other, PeriodIndex):
538+
if (
539+
not isinstance(other, Index)
540+
or other.empty
541+
or isinstance(other, PeriodIndex)
542+
):
539543
return super()._convert_can_do_setop(other)
540544

541545
# Convert non-PeriodIndex to PeriodIndex

0 commit comments

Comments
 (0)