Skip to content

Commit cbe73a6

Browse files
authored
ENH: Add use_na_sentinal (#333)
* ENH: Add use_na_sentinal * ENH: Add return type
1 parent fccdd10 commit cbe73a6

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

pandas-stubs/core/arrays/base.pyi

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ class ExtensionArray:
4343
def unique(self): ...
4444
def searchsorted(self, value, side: str = ..., sorter=...): ...
4545
def factorize(
46-
self, na_sentinel: int = ...
46+
self,
47+
# Not actually positional-only, used to handle deprecations in 1.5.0
48+
*,
49+
use_na_sentinel: bool = ...,
4750
) -> tuple[np.ndarray, ABCExtensionArray]: ...
4851
def repeat(self, repeats, axis=...): ...
4952
def take(

pandas-stubs/core/arrays/sparse/array.pyi

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from pandas.core.arrays import (
33
ExtensionArray,
44
ExtensionOpsMixin,
55
)
6-
from pandas.core.base import PandasObject as PandasObject
6+
from pandas.core.base import PandasObject
77

88
class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
99
def __init__(
@@ -42,7 +42,13 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
4242
def fillna(self, value=..., method=..., limit=...): ...
4343
def shift(self, periods: int = ..., fill_value=...): ...
4444
def unique(self): ...
45-
def factorize(self, na_sentinel: int = ...): ...
45+
def factorize( # type: ignore[override]
46+
self,
47+
na_sentinel: int = ...,
48+
# Not actually positional-only, used to handle deprecations in 1.5.0
49+
*,
50+
use_na_sentinel: bool = ...,
51+
) -> tuple[np.ndarray, SparseArray]: ...
4652
def value_counts(self, dropna: bool = ...): ...
4753
def __getitem__(self, key): ...
4854
def take(self, indices, allow_fill: bool = ..., fill_value=...): ...
@@ -62,5 +68,3 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
6268
def T(self): ...
6369
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ...
6470
def __abs__(self): ...
65-
66-
def make_sparse(arr, kind: str = ..., fill_value=..., dtype=..., copy: bool = ...): ...

pandas-stubs/core/indexes/range.pyi

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
from pandas.core.indexes.numeric import Int64Index
33

4+
from pandas._typing import npt
5+
46
class RangeIndex(Int64Index):
57
def __new__(
68
cls,
@@ -44,6 +46,13 @@ class RangeIndex(Int64Index):
4446
def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
4547
def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
4648
def argsort(self, *args, **kwargs): ...
49+
def factorize(
50+
self,
51+
sort: bool = ...,
52+
# Not actually positional-only, used to handle deprecations in 1.5.0
53+
*,
54+
use_na_sentinel: bool = ...,
55+
) -> tuple[npt.NDArray[np.intp], RangeIndex]: ...
4756
def equals(self, other): ...
4857
def intersection(self, other, sort: bool = ...): ...
4958
def join(

0 commit comments

Comments
 (0)