def _sub_period_array(self, other):
if not is_period_dtype(self):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>.format(dtype=other.dtype,<EOL>cls=type(self).__name__))<EOL><DEDENT>if len(self) != len(other):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if self.freq != other.freq:<EOL><INDENT>msg = DIFFERENT_FREQ.format(cls=type(self).__name__,<EOL>own_freq=self.freqstr,<EOL>other_freq=other.freqstr)<EOL>raise IncompatibleFrequency(msg)<EOL><DEDENT>new_values = checked_add_with_arr(self.asi8, -other.asi8,<EOL>arr_mask=self._isnan,<EOL>b_mask=other._isnan)<EOL>new_values = np.array([self.freq.base * x for x in new_values])<EOL>if self._hasnans or other._hasnans:<EOL><INDENT>mask = (self._isnan) | (other._isnan)<EOL>new_values[mask] = NaT<EOL><DEDENT>return new_values<EOL>
Subtract a Period Array/Index from self.  This is only valid if self
is itself a Period Array/Index, raises otherwise.  Both objects must
have the same frequency.

Parameters
----------
other : PeriodIndex or PeriodArray

Returns
-------
result : np.ndarray[object]
    Array of DateOffset objects; nulls represented by NaT.