Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def shift(self, periods: int = 1, fill_value: object = None) -> ExtensionArray:
b = empty
return self._concat_same_type([a, b])

def unique(self):
def unique(self: ExtensionArrayT) -> ExtensionArrayT:
"""
Compute the ExtensionArray of unique values.

Expand Down Expand Up @@ -1023,7 +1023,7 @@ def factorize(self, na_sentinel: int = -1) -> tuple[np.ndarray, ExtensionArray]:

@Substitution(klass="ExtensionArray")
@Appender(_extension_array_shared_docs["repeat"])
def repeat(self, repeats, axis=None):
def repeat(self, repeats: int | Sequence[int], axis: int | None = None):
nv.validate_repeat((), {"axis": axis})
ind = np.arange(len(self)).repeat(repeats)
return self.take(ind)
Expand Down
6 changes: 5 additions & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,11 @@ def delete(self: IntervalArrayT, loc) -> IntervalArrayT:
return self._shallow_copy(left=new_left, right=new_right)

@Appender(_extension_array_shared_docs["repeat"] % _shared_docs_kwargs)
def repeat(self: IntervalArrayT, repeats: int, axis=None) -> IntervalArrayT:
def repeat(
self: IntervalArrayT,
repeats: int | Sequence[int],
axis: int | None = None,
) -> IntervalArrayT:
nv.validate_repeat((), {"axis": axis})
left_repeat = self.left.repeat(repeats)
right_repeat = self.right.repeat(repeats)
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import pandas._libs.lib as lib
from pandas._typing import (
ArrayLike,
Dtype,
DtypeObj,
IndexLabel,
Expand Down Expand Up @@ -996,7 +997,7 @@ def unique(self):
values = self._values

if not isinstance(values, np.ndarray):
result = values.unique()
result: ArrayLike = values.unique()
if self.dtype.kind in ["m", "M"] and isinstance(self, ABCSeries):
# GH#31182 Series._values returns EA, unpack for backward-compat
if getattr(self.dtype, "tz", None) is None:
Expand Down