From 7f580601cba4cd4a3476e2cf48ac5df242dab992 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Thu, 30 May 2024 16:05:42 +0200 Subject: [PATCH] pandas 2.0 removals in core/arrays (#932) * Fix CI from PR 930 * pandas 2.0 removals in core/arrays * Revert "Fix CI from PR 930" This reverts commit 6ecbab99c37bcb83310eaaa04c24e9c54c45fbf5. --- pandas-stubs/core/arrays/categorical.pyi | 79 +++--------------------- pandas-stubs/core/arrays/datetimes.pyi | 2 - 2 files changed, 7 insertions(+), 74 deletions(-) diff --git a/pandas-stubs/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi index 2d0b16359..cb0aeaa42 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -2,11 +2,7 @@ from collections.abc import ( Callable, Sequence, ) -from typing import ( - Any, - Literal, - overload, -) +from typing import Any import numpy as np from pandas import Series @@ -48,7 +44,6 @@ class Categorical(ExtensionArray): def dtype(self) -> CategoricalDtype: ... def astype(self, dtype: Dtype, copy: bool = ...) -> ArrayLike: ... def size(self) -> int: ... - def itemsize(self) -> int: ... def tolist(self) -> list[Scalar]: ... to_list = ... @classmethod @@ -65,72 +60,16 @@ class Categorical(ExtensionArray): def set_ordered(self, value) -> Categorical: ... def as_ordered(self) -> Categorical: ... def as_unordered(self) -> Categorical: ... - @overload - def set_categories( - self, new_categories, ordered=..., rename: bool = ..., *, inplace: Literal[True] - ) -> None: ... - @overload - def set_categories( - self, - new_categories, - ordered=..., - rename: bool = ..., - inplace: Literal[False] = ..., - ) -> Categorical: ... - @overload def set_categories( - self, new_categories, ordered=..., rename: bool = ..., inplace: bool = ... - ) -> Categorical | None: ... - @overload - def rename_categories(self, new_categories, inplace: Literal[True]) -> None: ... - @overload - def rename_categories( - self, new_categories, inplace: Literal[False] = ... + self, new_categories, ordered: bool | None = ..., rename: bool = ... ) -> Categorical: ... - @overload - def rename_categories( - self, new_categories, inplace: bool = ... - ) -> Categorical | None: ... - @overload - def reorder_categories( - self, new_categories, ordered=..., *, inplace: Literal[True] - ) -> None: ... - @overload + def rename_categories(self, new_categories) -> Categorical: ... def reorder_categories( - self, new_categories, ordered=..., inplace: Literal[False] = ... - ) -> Categorical: ... - @overload - def reorder_categories( - self, new_categories, ordered=..., inplace: bool = ... - ) -> Categorical | None: ... - @overload - def add_categories(self, new_categories, inplace: Literal[True]) -> None: ... - @overload - def add_categories( - self, new_categories, inplace: Literal[False] = ... - ) -> Categorical: ... - @overload - def add_categories( - self, new_categories, inplace: bool = ... - ) -> Categorical | None: ... - @overload - def remove_categories(self, removals, inplace: Literal[True]) -> None: ... - @overload - def remove_categories( - self, removals, inplace: Literal[False] = ... - ) -> Categorical: ... - @overload - def remove_categories( - self, removals, inplace: bool = ... - ) -> Categorical | None: ... - @overload - def remove_unused_categories(self, inplace: Literal[True]) -> None: ... - @overload - def remove_unused_categories( - self, inplace: Literal[False] = ... + self, new_categories, ordered: bool | None = ... ) -> Categorical: ... - @overload - def remove_unused_categories(self, inplace: bool = ...) -> Categorical | None: ... + def add_categories(self, new_categories) -> Categorical: ... + def remove_categories(self, removals) -> Categorical: ... + def remove_unused_categories(self) -> Categorical: ... def map(self, mapper): ... def __eq__(self, other) -> bool: ... def __ne__(self, other) -> bool: ... @@ -161,12 +100,10 @@ class Categorical(ExtensionArray): self, *, inplace: bool = ..., ascending: bool = ..., na_position: str = ... ): ... def view(self, dtype=...): ... - def to_dense(self): ... def fillna(self, value=..., method=..., limit=...): ... def take( self, indexer: TakeIndexer, *, allow_fill: bool = ..., fill_value=... ) -> Categorical: ... - def take_nd(self, indexer, allow_fill: bool = ..., fill_value=...): ... def __len__(self) -> int: ... def __iter__(self): ... def __contains__(self, key) -> bool: ... @@ -174,10 +111,8 @@ class Categorical(ExtensionArray): def __setitem__(self, key, value) -> None: ... def min(self, *, skipna: bool = ...): ... def max(self, *, skipna: bool = ...): ... - def mode(self, dropna: bool = ...): ... def unique(self): ... def equals(self, other): ... - def is_dtype_equal(self, other): ... def describe(self): ... def repeat(self, repeats, axis=...): ... def isin(self, values): ... diff --git a/pandas-stubs/core/arrays/datetimes.pyi b/pandas-stubs/core/arrays/datetimes.pyi index 5afcb6898..7e4c7d7a1 100644 --- a/pandas-stubs/core/arrays/datetimes.pyi +++ b/pandas-stubs/core/arrays/datetimes.pyi @@ -50,8 +50,6 @@ class DatetimeArray(DatetimeLikeArrayMixin, TimelikeOps, DatelikeOps): second = ... microsecond = ... nanosecond = ... - weekofyear = ... - week = ... dayofweek = ... weekday = ... dayofyear = ...