Skip to content

Commit 10b87cd

Browse files
authored
Add None as possible parameter value to isnull/isna/notnull/notna (#325)
1 parent 37f07f9 commit 10b87cd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pandas-stubs/core/dtypes/missing.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def isna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
3030
@overload
3131
def isna(obj: Scalar) -> bool: ...
3232
@overload
33-
def isna(obj: NaTType | NAType) -> Literal[True]: ...
33+
def isna(obj: NaTType | NAType | None) -> Literal[True]: ...
3434

3535
isnull = isna
3636

@@ -43,6 +43,6 @@ def notna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
4343
@overload
4444
def notna(obj: Scalar) -> bool: ...
4545
@overload
46-
def notna(obj: NaTType | NAType) -> Literal[False]: ...
46+
def notna(obj: NaTType | NAType | None) -> Literal[False]: ...
4747

4848
notnull = notna

tests/test_pandas.py

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ def test_isna() -> None:
136136
assert check(assert_type(pd.isna(pd.NaT), Literal[True]), bool)
137137
assert not check(assert_type(pd.notna(pd.NaT), Literal[False]), bool)
138138

139+
assert check(assert_type(pd.isna(None), Literal[True]), bool)
140+
assert not check(assert_type(pd.notna(None), Literal[False]), bool)
141+
139142
check(assert_type(pd.isna(2.5), bool), bool)
140143
check(assert_type(pd.notna(2.5), bool), bool)
141144

0 commit comments

Comments
 (0)