diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 457419cacf9e7..5f267a9f816e7 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -370,10 +370,15 @@ def _unbox_scalar( # type: ignore[override] def _scalar_from_string(self, value: str) -> Period: return Period(value, freq=self.freq) - def _check_compatible_with(self, other: Period | NaTType | PeriodArray) -> None: + # error: Argument 1 of "_check_compatible_with" is incompatible with + # supertype "DatetimeLikeArrayMixin"; supertype defines the argument type + # as "Period | Timestamp | Timedelta | NaTType" + def _check_compatible_with(self, other: Period | NaTType | PeriodArray) -> None: # type: ignore[override] if other is NaT: return - self._require_matching_freq(other.freq) + # error: Item "NaTType" of "Period | NaTType | PeriodArray" has no + # attribute "freq" + self._require_matching_freq(other.freq) # type: ignore[union-attr] # -------------------------------------------------------------------- # Data / Attributes