5

As I was practicing my visualization skills, I came across an article ,

https://towardsdatascience.com/complete-guide-to-data-visualization-with-python-2dd74df12b5e.

In this, the person has used pandas-profiling method, which was new to me I tried using it for my dataset but got an unexpected error.

Here is the code :

    import pandas_profiling
    from pandas_profiling import ProfileReport
    prof = ProfileReport(temp)
    prof.to_file(output_file='report.html')

but getting this error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\anaconda3\lib\site-packages\matplotlib\style\core.py in use(style)
    114             # rcParamsDefault, no need to reemit them here.
--> 115             with cbook._suppress_matplotlib_deprecation_warning():
    116                 _apply_style(rcParamsDefault, warn=False)

~\anaconda3\lib\site-packages\matplotlib\__init__.py in rc_params_from_file(fname, fail_on_error, use_default_template)
    795     """
--> 796     Construct a `RcParams` instance from file *fname*.
    797 

~\anaconda3\lib\site-packages\matplotlib\__init__.py in _rc_params_in_file(fname, transform, fail_on_error)
    724         with cbook._suppress_matplotlib_deprecation_warning():
--> 725             yield from sorted(dict.__iter__(self))
    726 

~\anaconda3\lib\contextlib.py in __enter__(self)
    112         try:
--> 113             return next(self.gen)
114         except StopIteration:

~\anaconda3\lib\site-packages\matplotlib\__init__.py in _open_file_or_url(fname)
    702                 from matplotlib import pyplot as plt
--> 703                 plt.switch_backend(rcsetup._auto_backend_sentinel)
    704 

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\a\\anaconda3\\lib\\site-packages\\pandas_profiling\\pandas_profiling.mplstyle'

The above exception was the direct cause of the following exception:

OSError                                   Traceback (most recent call last)
<ipython-input-61-8913bd122e77> in <module>
      1 import pandas_profiling
      2 from pandas_profiling import ProfileReport
----> 3 prof = ProfileReport(temp)
      4 prof.to_file(output_file='report.html')

~\anaconda3\lib\site-packages\pandas_profiling\__init__.py in __init__(self, df, **kwargs)

~\anaconda3\lib\site-packages\pandas_profiling\describe.py in describe(df, bins, check_correlation, correlation_threshold, correlation_overrides, check_recoded, pool_size, **kwargs)

~\anaconda3\lib\site-packages\matplotlib\style\core.py in use(style)
    116                 _apply_style(rcParamsDefault, warn=False)
    117         elif style in library:
--> 118             _apply_style(library[style])
    119         else:
    120             try:

OSError: 'C:\\Users\\a\\anaconda3\\lib\\site-packages\\pandas_profiling\\pandas_profiling.mplstyle' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles

I don't know what is mpl.style, as there was nothing in this location when checked.

Shivam Jolly
  • 51
  • 1
  • 4

3 Answers3

1

Do the following steps:

  1. pip uninstall pandas-profiling
  2. pip install pandas-profiling[notebook]
  3. pip show pandas-profiling
Deep P S
  • 11
  • 4
  • If it doesn't work, try doing these steps: 1. conda update pip 2. pip uninstall pandas-profiling 3. pip install pandas-profiling[notebook] 4. pip show pandas-profiling if there is a problem:“500 : Internal Server Error” try: conda install nbconvert=5.4.1 – Deep P S Jun 22 '21 at 15:57
1

Run below commands on jupyter Notebook

!pip uninstall -y pandas-profiling

then

pip install pandas-profiling

Now restart Kernel in jupyter notebook and try running your code.

0

I was getting the same error the. Here is what I did to solve it.

Note: I was using Anaconda

  • Uninstall the old pandas_profiling
  • Install the latest version using conda install -c conda-forge pandas-profiling=2.6.0

Important: Don't forget to restart the kernal

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hadi Mir
  • 4,497
  • 2
  • 29
  • 31