Skip to content
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

GH1037 Remove na_sentinel from factorize methods #1038

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 2 deletions pandas-stubs/core/arrays/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class ExtensionArray:
def shift(self, periods: int = ..., fill_value: object = ...) -> Self: ...
def unique(self): ...
def searchsorted(self, value, side: str = ..., sorter=...): ...
# TODO: remove keyword-only when pandas removed na_sentinel
def factorize(self, *, use_na_sentinel: bool = ...) -> tuple[np.ndarray, Self]: ...
def factorize(
self, sort: bool = ..., use_na_sentinel: bool = ...
loicdiridollou marked this conversation as resolved.
Show resolved Hide resolved
) -> tuple[np.ndarray, Self]: ...
def repeat(self, repeats, axis=...): ...
def take(
self,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def test_lreshape() -> None:


def test_factorize() -> None:
codes, uniques = pd.factorize(np.array(["b", "b", "a", "c", "b"]))
codes, uniques = pd.factorize(np.array(["b", "b", "a", "c", "b"]), sort=False)
loicdiridollou marked this conversation as resolved.
Show resolved Hide resolved
check(assert_type(codes, np.ndarray), np.ndarray)
check(assert_type(uniques, np.ndarray), np.ndarray)

Expand Down
Loading