Skip to content

Commit 6dec3d5

Browse files
committed
fix: use DataFrame.map for pandas 2.1+ (applymap removed)
CI installs unpinned pandas; 3.11+ matrix jobs hit AttributeError on applymap. Require pandas>=2.1 where map replaced applymap.
1 parent c3a0935 commit 6dec3d5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pyfair/report/base_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def _get_overview_table(self, model_or_models):
262262
risk_results = risk_results.agg(["mean", "std", "min", "max"])
263263
risk_results.index = ["Mean", "Stdev", "Minimum", "Maximum"]
264264
# Format risk results into dataframe
265-
overview_df = risk_results.applymap(
265+
overview_df = risk_results.map(
266266
lambda x: self._format_strings["Risk"].format(x)
267267
)
268268
overview_df.loc["Simulations"] = [
@@ -321,7 +321,7 @@ def _get_model_parameter_table(self, model):
321321
# On a column basis
322322
axis=1,
323323
)
324-
param_df = param_df.applymap(lambda x: "" if "nan" in x else x)
324+
param_df = param_df.map(lambda x: "" if "nan" in x else x)
325325
# Do not truncate our base64 images.
326326
pd.set_option("display.max_colwidth", None)
327327
# Create our distribution icons as strings in table

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pandas>=0.24.1
1+
pandas>=2.1.0
22
numpy>=1.16.1
33
scipy>=1.2.1
44
matplotlib>=3.0.2

0 commit comments

Comments
 (0)