diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 2d6292faf..ef52cdaf9 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -1316,7 +1316,7 @@ class DataFrame(NDFrame, OpsMixin): ) -> DataFrame: ... # Add spacing between apply() overloads and remaining annotations - def applymap( + def map( self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs ) -> DataFrame: ... def join( diff --git a/pyproject.toml b/pyproject.toml index 22bd97607..fa9326d53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "1.6.0" pandas = "2.1.1" pyarrow = ">=10.0.1" pytest = ">=7.1.2" -pyright = ">=1.1.331" +pyright = "==1.1.331" poethepoet = ">=0.16.5" loguru = ">=0.6.0" typing-extensions = ">=4.4.0" diff --git a/tests/test_frame.py b/tests/test_frame.py index c6bb280b9..be7e9fd9f 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -728,17 +728,15 @@ def gethead(s: pd.Series, y: int) -> pd.Series: ) -def test_types_applymap() -> None: - with pytest_warns_bounded( - FutureWarning, "DataFrame.applymap has been deprecated", lower="2.0.99" - ): - df = pd.DataFrame(data={"col1": [2, 1], "col2": [3, 4]}) - df.applymap(lambda x: x**2) - df.applymap(np.exp) - df.applymap(str) - # na_action parameter was added in 1.2.0 https://pandas.pydata.org/docs/whatsnew/v1.2.0.html - df.applymap(np.exp, na_action="ignore") - df.applymap(str, na_action=None) +def test_types_map() -> None: + # GH774 + df = pd.DataFrame(data={"col1": [2, 1], "col2": [3, 4]}) + df.map(lambda x: x**2) + df.map(np.exp) + df.map(str) + # na_action parameter was added in 1.2.0 https://pandas.pydata.org/docs/whatsnew/v1.2.0.html + df.map(np.exp, na_action="ignore") + df.map(str, na_action=None) def test_types_element_wise_arithmetic() -> None: