Skip to content

Commit 6374fed

Browse files
committed
Made some changes:
- Removed stub and test for applymap - Downgraded pyright - Ran the precommit (it just removes some whitespace)
1 parent a197d54 commit 6374fed

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,11 @@ class DataFrame(NDFrame, OpsMixin):
13161316
) -> DataFrame: ...
13171317

13181318
# Add spacing between apply() overloads and remaining annotations
1319-
# In pandas 2.1.0 and later, arraymap deprecated replaced with map
1319+
# Deprecated in pandas 2.1.0 and later
1320+
def applymap(
1321+
self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs
1322+
) -> DataFrame: ...
1323+
# In pandas 2.1.0 and later: applymap is renamed map, applymap is deprecated
13201324
def map(
13211325
self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs
13221326
) -> DataFrame: ...

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mypy = "1.6.0"
3939
pandas = "2.1.1"
4040
pyarrow = ">=10.0.1"
4141
pytest = ">=7.1.2"
42-
pyright = "==1.1.331" # Don't use 1.1.332
42+
pyright = ">=1.1.331"
4343
poethepoet = ">=0.16.5"
4444
loguru = ">=0.6.0"
4545
typing-extensions = ">=4.4.0"

tests/test_frame.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,21 @@ def gethead(s: pd.Series, y: int) -> pd.Series:
728728
)
729729

730730

731-
# In pandas 2.1.0 and later, arraymap deprecated replaced with map
731+
# Deprecated in pandas 2.1.0
732+
def test_types_applymap() -> None:
733+
with pytest_warns_bounded(
734+
FutureWarning, "DataFrame.applymap has been deprecated", lower="2.0.99"
735+
):
736+
df = pd.DataFrame(data={"col1": [2, 1], "col2": [3, 4]})
737+
df.applymap(lambda x: x**2)
738+
df.applymap(np.exp)
739+
df.applymap(str)
740+
# na_action parameter was added in 1.2.0 https://pandas.pydata.org/docs/whatsnew/v1.2.0.html
741+
df.applymap(np.exp, na_action="ignore")
742+
df.applymap(str, na_action=None)
743+
744+
745+
# Added in pandas 2.1.0
732746
def test_types_map() -> None:
733747
df = pd.DataFrame(data={"col1": [2, 1], "col2": [3, 4]})
734748
df.map(lambda x: x**2)

0 commit comments

Comments
 (0)