Skip to content

Commit d406af0

Browse files
simonjayhawkinsproost
authored andcommitted
TYP: some types for pandas/core/arrays/sparse/array.py (pandas-dev#29898)
1 parent 968beb1 commit d406af0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/core/arrays/sparse/array.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
260260
_pandas_ftype = "sparse"
261261
_subtyp = "sparse_array" # register ABCSparseArray
262262
_deprecations = PandasObject._deprecations | frozenset(["get_values"])
263+
_sparse_index: SparseIndex
263264

264265
def __init__(
265266
self,
@@ -372,8 +373,8 @@ def __init__(
372373

373374
@classmethod
374375
def _simple_new(
375-
cls, sparse_array: np.ndarray, sparse_index: SparseIndex, dtype: SparseDtype
376-
) -> ABCSparseArray:
376+
cls, sparse_array: np.ndarray, sparse_index: SparseIndex, dtype: SparseDtype,
377+
) -> "SparseArray":
377378
new = cls([])
378379
new._sparse_index = sparse_index
379380
new._sparse_values = sparse_array
@@ -1392,8 +1393,8 @@ def __abs__(self):
13921393
# ------------------------------------------------------------------------
13931394

13941395
@classmethod
1395-
def _create_unary_method(cls, op):
1396-
def sparse_unary_method(self):
1396+
def _create_unary_method(cls, op) -> Callable[["SparseArray"], "SparseArray"]:
1397+
def sparse_unary_method(self) -> "SparseArray":
13971398
fill_value = op(np.array(self.fill_value)).item()
13981399
values = op(self.sp_values)
13991400
dtype = SparseDtype(values.dtype, fill_value)

0 commit comments

Comments
 (0)