From 5f23aced2f97f2ed481deda4eaeeb049d6c7debe Mon Sep 17 00:00:00 2001 From: SiemBerhane <65135505+SiemBerhane@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:41:44 +0000 Subject: [PATCH] ENH: set __module__ on isna and notna (#60271) --- pandas/core/dtypes/missing.py | 3 +++ pandas/tests/api/test_api.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index b9cd6ae2f13e8..f20ca44728664 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -19,6 +19,7 @@ NaT, iNaT, ) +from pandas.util._decorators import set_module from pandas.core.dtypes.common import ( DT64NS_DTYPE, @@ -93,6 +94,7 @@ def isna( def isna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame: ... +@set_module("pandas") def isna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame: """ Detect missing values for an array-like object. @@ -307,6 +309,7 @@ def notna( def notna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame: ... +@set_module("pandas") def notna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame: """ Detect non-missing values for an array-like object. diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 8209ff86c62f1..75f9958b16286 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -417,6 +417,8 @@ def test_set_module(): assert pd.Period.__module__ == "pandas" assert pd.Timestamp.__module__ == "pandas" assert pd.Timedelta.__module__ == "pandas" + assert pd.isna.__module__ == "pandas" + assert pd.notna.__module__ == "pandas" assert pd.merge.__module__ == "pandas" assert pd.merge_ordered.__module__ == "pandas" assert pd.merge_asof.__module__ == "pandas"