MAIF / shapash

🔅 Shapash: User-friendly Explainability and Interpretability to Develop Reliable and Transparent Machine Learning Models
https://maif.github.io/shapash/
Apache License 2.0
2.71k stars 329 forks source link

[fix] Issue 554 - ValueError: cannot convert float NaN to integer #555

Closed tswsxk closed 2 months ago

tswsxk commented 3 months ago

Description

Fixes #554

Type of change

Please delete options that are not relevant.

Change line 196 from:

 if std != 0:
    digit = max(round(log10(1 / std) + 1) + 2, 0)
    self.round_dataframe[col] = self.dataframe[col].map(f"{{:.{digit}f}}".format).astype(float)

to

 if std != 0 and not pd.isna(std):
    digit = max(round(log10(1 / std) + 1) + 2, 0)
    self.round_dataframe[col] = self.dataframe[col].map(f"{{:.{digit}f}}".format).astype(float)

Test Configuration:

Checklist:

guillaume-vignal commented 2 months ago

Thanks @tswsxk for your PR, the issue has been fixed with https://github.com/MAIF/shapash/pull/553. Don't hesitate to test the new version 2.6.0 of Shapash and tell us if everything is good.