Skip to content

Commit ea8bdee

Browse files
Add type parameters to generics in isna and notna (#945)
* Add type parameters to generics in isna and notna * Reintroduce ArrayLike
1 parent 54a763c commit ea8bdee

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pandas-stubs/_typing.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ from pandas.io.formats.format import EngFormatter
5353
# where it is the only acceptable type.
5454
Incomplete: TypeAlias = Any
5555

56-
ArrayLike: TypeAlias = ExtensionArray | np.ndarray
56+
ArrayLike: TypeAlias = ExtensionArray | np.ndarray[Any, Any]
5757
AnyArrayLike: TypeAlias = Index | Series | np.ndarray
5858
PythonScalar: TypeAlias = str | bool | complex
5959
DatetimeLikeScalar = TypeVar("DatetimeLikeScalar", Period, Timestamp, Timedelta)

pandas-stubs/core/dtypes/missing.pyi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from typing import overload
1+
from typing import (
2+
Any,
3+
overload,
4+
)
25

36
import numpy as np
47
from numpy import typing as npt
@@ -23,9 +26,9 @@ isneginf_scalar = ...
2326
@overload
2427
def isna(obj: DataFrame) -> DataFrame: ...
2528
@overload
26-
def isna(obj: Series) -> Series[bool]: ...
29+
def isna(obj: Series[Any]) -> Series[bool]: ...
2730
@overload
28-
def isna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
31+
def isna(obj: Index[Any] | list[Any] | ArrayLike) -> npt.NDArray[np.bool_]: ...
2932
@overload
3033
def isna(
3134
obj: Scalar | NaTType | NAType | None,
@@ -36,9 +39,9 @@ isnull = isna
3639
@overload
3740
def notna(obj: DataFrame) -> DataFrame: ...
3841
@overload
39-
def notna(obj: Series) -> Series[bool]: ...
42+
def notna(obj: Series[Any]) -> Series[bool]: ...
4043
@overload
41-
def notna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
44+
def notna(obj: Index[Any] | list[Any] | ArrayLike) -> npt.NDArray[np.bool_]: ...
4245
@overload
4346
def notna(obj: ScalarT | NaTType | NAType | None) -> TypeGuard[ScalarT]: ...
4447

0 commit comments

Comments
 (0)