Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,8 @@ class DataFrame(NDFrame, OpsMixin):
) -> DataFrame: ...

# Add spacing between apply() overloads and remaining annotations
def applymap(
# In pandas 2.1.0 and later: applymap is renamed map, applymap is deprecated
def map(
self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs
) -> DataFrame: ...
def join(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 9 additions & 11 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
# In pandas 2.1.0 and later: applymap is renamed map, applymap is deprecated
def test_types_map() -> None:
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:
Expand Down