Skip to content

Commit f83ac12

Browse files
jbrockmendelhweecat
authored andcommitted
CLN: remove no-longer-reachable addsub_int_array (pandas-dev#30592)
1 parent b2e6f20 commit f83ac12

File tree

2 files changed

+16
-38
lines changed

2 files changed

+16
-38
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,39 +1093,6 @@ def _sub_period_array(self, other):
10931093
new_values[mask] = NaT
10941094
return new_values
10951095

1096-
def _addsub_int_array(self, other, op):
1097-
"""
1098-
Add or subtract array-like of integers equivalent to applying
1099-
`_time_shift` pointwise.
1100-
1101-
Parameters
1102-
----------
1103-
other : Index, ExtensionArray, np.ndarray
1104-
integer-dtype
1105-
op : {operator.add, operator.sub}
1106-
1107-
Returns
1108-
-------
1109-
result : same class as self
1110-
"""
1111-
# _addsub_int_array is overridden by PeriodArray
1112-
assert not is_period_dtype(self)
1113-
assert op in [operator.add, operator.sub]
1114-
1115-
if self.freq is None:
1116-
# GH#19123
1117-
raise NullFrequencyError("Cannot shift with no freq")
1118-
1119-
elif isinstance(self.freq, Tick):
1120-
# easy case where we can convert to timedelta64 operation
1121-
td = Timedelta(self.freq)
1122-
return op(self, td * other)
1123-
1124-
# We should only get here with DatetimeIndex; dispatch
1125-
# to _addsub_offset_array
1126-
assert not is_timedelta64_dtype(self)
1127-
return op(self, np.array(other) * self.freq)
1128-
11291096
def _addsub_offset_array(self, other, op):
11301097
"""
11311098
Add or subtract array-like of DateOffset objects

pandas/core/arrays/period.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,23 @@ def _sub_period(self, other):
637637

638638
return new_data
639639

640-
@Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__)
641640
def _addsub_int_array(
642-
self,
643-
other: Union[ABCPeriodArray, ABCSeries, ABCPeriodIndex, np.ndarray],
644-
op: Callable[[Any], Any],
645-
) -> ABCPeriodArray:
641+
self, other: np.ndarray, op: Callable[[Any], Any],
642+
) -> "PeriodArray":
643+
"""
644+
Add or subtract array of integers; equivalent to applying
645+
`_time_shift` pointwise.
646+
647+
Parameters
648+
----------
649+
other : np.ndarray[integer-dtype]
650+
op : {operator.add, operator.sub}
651+
652+
Returns
653+
-------
654+
result : PeriodArray
655+
"""
656+
646657
assert op in [operator.add, operator.sub]
647658
if op is operator.sub:
648659
other = -other

0 commit comments

Comments
 (0)