Skip to content

Add None as possible parameter value to isnull/isna/notnull/notna #325

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

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions pandas-stubs/core/dtypes/missing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def isna(obj: Index | list | ArrayLike) -> npt.NDArray[np.bool_]: ...
@overload
def isna(obj: Scalar) -> bool: ...
@overload
def isna(obj: NaTType | NAType) -> Literal[True]: ...
def isna(obj: NaTType | NAType | None) -> Literal[True]: ...

isnull = isna

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

notnull = notna
3 changes: 3 additions & 0 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def test_isna() -> None:
assert check(assert_type(pd.isna(pd.NaT), Literal[True]), bool)
assert not check(assert_type(pd.notna(pd.NaT), Literal[False]), bool)

assert check(assert_type(pd.isna(None), Literal[True]), bool)
assert not check(assert_type(pd.notna(None), Literal[False]), bool)

check(assert_type(pd.isna(2.5), bool), bool)
check(assert_type(pd.notna(2.5), bool), bool)

Expand Down