0

I'm having an issue while trying to run the comparison report on ydata-profiling. I was trying to follow this tutorial and I'm not sure what went wrong...

import pandas as pd
from pandas_profiling import ProfileReport

df = pd.read_csv("hcc.csv")
profile = ProfileReport(df,title="HCC Profile Report")
     
# Impute Missing Values
df_transformed = df.copy()
from sklearn.impute import SimpleImputer
mean_imputer = SimpleImputer(strategy="mean")
df_transformed['Ferritin'] = mean_imputer.fit_transform(df_transformed['Ferritin'].values.reshape(-1,1))

transformed_profile = ProfileReport(df_transformed, title="Transformed Data")
comparison_report = profile.compare(transformed_profile)
comparison_report.to_file("original_vs_transformed.html")

Error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-2068c7bbb3f6> in <module>
      1 transformed_profile = ProfileReport(df_transformed, title="Transformed Data")
      2 comparison_report = profile.compare(transformed_profile)
----> 3 comparison_report.to_file("original_vs_transformed.html")

16 frames
/usr/local/lib/python3.8/dist-packages/pandas_profiling/visualisation/plot.py in _plot_histogram(config, series, bins, figsize, date, hide_yaxis)
     74 
     75         if not hide_yaxis:
---> 76             fig.supylabel("Frequency")
     77     else:
     78         fig = plt.figure(figsize=figsize)

AttributeError: 'Figure' object has no attribute 'supylabel'
Laurel
  • 5,965
  • 14
  • 31
  • 57

1 Answers1

0

Google Colab have pre-installed a Matplolib version that is not compatible with the package.

To update the matplotlib version to a version that meets the requirements matplotlib>=3.2, <3.7, might solve the issue.

FabC
  • 26
  • 3