Skip to content

Commit 068e199

Browse files
Add type parameters to generics in isna and notna
1 parent 54a763c commit 068e199

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
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: 13 additions & 6 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
@@ -7,12 +10,12 @@ from pandas import (
710
Index,
811
Series,
912
)
13+
from pandas.core.arrays.base import ExtensionArray
1014
from typing_extensions import TypeGuard
1115

1216
from pandas._libs.missing import NAType
1317
from pandas._libs.tslibs import NaTType
1418
from pandas._typing import (
15-
ArrayLike,
1619
Scalar,
1720
ScalarT,
1821
)
@@ -23,9 +26,11 @@ 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(
32+
obj: Index[Any] | list[Any] | ExtensionArray | np.ndarray[Any, Any]
33+
) -> npt.NDArray[np.bool_]: ...
2934
@overload
3035
def isna(
3136
obj: Scalar | NaTType | NAType | None,
@@ -36,9 +41,11 @@ isnull = isna
3641
@overload
3742
def notna(obj: DataFrame) -> DataFrame: ...
3843
@overload
39-
def notna(obj: Series) -> Series[bool]: ...
44+
def notna(obj: Series[Any]) -> Series[bool]: ...
4045
@overload
41-
def notna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
46+
def notna(
47+
obj: Index[Any] | list[Any] | ExtensionArray | np.ndarray[Any, Any]
48+
) -> npt.NDArray[np.bool_]: ...
4249
@overload
4350
def notna(obj: ScalarT | NaTType | NAType | None) -> TypeGuard[ScalarT]: ...
4451

0 commit comments

Comments
 (0)