MatplotlibDeprecationWarning: when using ydata_profiling

140 views Asked by At

pandas_profiling is deprecated and now need to use 'ydata-profiling' instead (pandas-profiling). When using ydata-profiling, following warning arises when saving profile report to a html file.

MatplotlibDeprecationWarning: mplDeprecation was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use matplotlib.MatplotlibDeprecationWarning instead

Warning arises in
File ~\anaconda3\envs\spe\lib\site-packages\ydata_profiling\visualisation\context.py:85, in manage_matplotlib_context()
83 deregister_matplotlib_converters() # revert to original unit registries
84 with warnings.catch_warnings():
---> 85 warnings.filterwarnings("ignore", category=matplotlib.cbook.mplDeprecation)
86 matplotlib.rcParams.update(originalRcParams)

I'm using following code to create the profile report for the data frame called 'df',

import pandas as pd
from ydata_profiling import ProfileReport

# generate pandas_profiling reports
report = ProfileReport(df,
                   sample = None,
                   missing_diagrams = None,
                   duplicates = None,
                   interactions = None,
                   title="Correlation Comparison",
                   correlations={"pearson": {"calculate": True},
                                 "spearman": {"calculate": True},
                                 "kendall": {"calculate": True},
                                 "phi_k": {"calculate": True},
                                 "auto": {"calculate": False},
                                 })
# create the output file paths
html_file_name = report_name + '.html'

file_path_to_html = os.path.join( os.getcwd(), html_file_name)

report.to_file(file_path_to_html)

I tried following in my notebook:

import warnings
import matplotlib
warnings.filterwarnings("ignore",category=matplotlib.MatplotlibDeprecationWarning)

But still the warning is there and code is not working!!!

I'm using following ydata_profiling and matplotlib versions, ydata_profiling == v4.5.1
matplotlib == 3.7.3

0

There are 0 answers