Skip to content

Commit 7211049

Browse files
authored
CLN/ASV: DataFrame.applymap (deprecated) -> DataFrame.map (pandas-dev#54221)
1 parent af76d78 commit 7211049

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

asv_bench/benchmarks/io/csv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def setup(self, sep, thousands, engine):
341341
if thousands is not None:
342342
fmt = f":{thousands}"
343343
fmt = "{" + fmt + "}"
344-
df = df.applymap(lambda x: fmt.format(x))
344+
df = df.map(lambda x: fmt.format(x))
345345
df.to_csv(self.fname, sep=sep)
346346

347347
def time_thousands(self, sep, thousands, engine):

asv_bench/benchmarks/io/excel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def time_write_excel_style(self, engine):
5757
bio.seek(0)
5858
with ExcelWriter(bio, engine=engine) as writer:
5959
df_style = self.df.style
60-
df_style.applymap(lambda x: "border: red 1px solid;")
61-
df_style.applymap(lambda x: "color: blue")
62-
df_style.applymap(lambda x: "border-color: green black", subset=["float1"])
60+
df_style.map(lambda x: "border: red 1px solid;")
61+
df_style.map(lambda x: "color: blue")
62+
df_style.map(lambda x: "border-color: green black", subset=["float1"])
6363
df_style.to_excel(writer, sheet_name="Sheet1")
6464

6565

asv_bench/benchmarks/io/style.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _apply_func(s):
6666
self.st = self.df.style.apply(_apply_func, axis=1)
6767

6868
def _style_classes(self):
69-
classes = self.df.applymap(lambda v: ("cls-1" if v > 0 else ""))
69+
classes = self.df.map(lambda v: ("cls-1" if v > 0 else ""))
7070
classes.index, classes.columns = self.df.index, self.df.columns
7171
self.st = self.df.style.set_td_classes(classes)
7272

@@ -80,7 +80,7 @@ def _style_format(self):
8080
)
8181

8282
def _style_apply_format_hide(self):
83-
self.st = self.df.style.applymap(lambda v: "color: red;")
83+
self.st = self.df.style.map(lambda v: "color: red;")
8484
self.st.format("{:.3f}")
8585
self.st.hide(self.st.index[1:], axis=0)
8686
self.st.hide(self.st.columns[1:], axis=1)

0 commit comments

Comments
 (0)