Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2552,12 +2552,11 @@ class Period(_Period):
hour, minute, second, freq)

elif is_period_object(value):
other = value
if freq is None or freq._period_dtype_code == other.freq._period_dtype_code:
ordinal = other.ordinal
freq = other.freq
if freq is None or freq == value.freq:
ordinal = value.ordinal
freq = value.freq
else:
converted = other.asfreq(freq)
converted = value.asfreq(freq)
ordinal = converted.ordinal

elif checknull_with_nat(value) or (isinstance(value, str) and
Expand Down