Skip to content

ENH: Add use_na_sentinal #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 27, 2022
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
5 changes: 4 additions & 1 deletion pandas-stubs/core/arrays/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class ExtensionArray:
def unique(self): ...
def searchsorted(self, value, side: str = ..., sorter=...): ...
def factorize(
self, na_sentinel: int = ...
self,
# Not actually positional-only, used to handle deprecations in 1.5.0
*,
use_na_sentinel: bool = ...,
) -> tuple[np.ndarray, ABCExtensionArray]: ...
def repeat(self, repeats, axis=...): ...
def take(
Expand Down
12 changes: 8 additions & 4 deletions pandas-stubs/core/arrays/sparse/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from pandas.core.arrays import (
ExtensionArray,
ExtensionOpsMixin,
)
from pandas.core.base import PandasObject as PandasObject
from pandas.core.base import PandasObject

class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
def __init__(
Expand Down Expand Up @@ -42,7 +42,13 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
def fillna(self, value=..., method=..., limit=...): ...
def shift(self, periods: int = ..., fill_value=...): ...
def unique(self): ...
def factorize(self, na_sentinel: int = ...): ...
def factorize( # type: ignore[override]
self,
na_sentinel: int = ...,
# Not actually positional-only, used to handle deprecations in 1.5.0
*,
use_na_sentinel: bool = ...,
) -> tuple[np.ndarray, SparseArray]: ...
def value_counts(self, dropna: bool = ...): ...
def __getitem__(self, key): ...
def take(self, indices, allow_fill: bool = ..., fill_value=...): ...
Expand All @@ -62,5 +68,3 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
def T(self): ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ...
def __abs__(self): ...

def make_sparse(arr, kind: str = ..., fill_value=..., dtype=..., copy: bool = ...): ...
9 changes: 9 additions & 0 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import numpy as np
from pandas.core.indexes.numeric import Int64Index

from pandas._typing import npt

class RangeIndex(Int64Index):
def __new__(
cls,
Expand Down Expand Up @@ -44,6 +46,13 @@ class RangeIndex(Int64Index):
def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
def argsort(self, *args, **kwargs): ...
def factorize(
self,
sort: bool = ...,
# Not actually positional-only, used to handle deprecations in 1.5.0
*,
use_na_sentinel: bool = ...,
) -> tuple[npt.NDArray[np.intp], RangeIndex]: ...
def equals(self, other): ...
def intersection(self, other, sort: bool = ...): ...
def join(
Expand Down