關於pandas_profiling使用
Question:請問老師安裝pandas_profiling後無法使用的原因?
import numpy as np
import pandas as pd
from pandas_profiling import ProfileReport
df2 = pd.DataFrame(
np.random.rand(100, 5),
columns=["a", "b", "c", "d", "e"])
df2
profile = ProfileReport(df2, title="Pandas Profiling Report")
FileNotFoundError                         Traceback (most recent call last)
~\Anaconda3\lib\site-packages\matplotlib\style\core.py in use(style)
    120             try:
--> 121                 rc = rc_params_from_file(style, use_default_template=False)
    122                 _apply_style(rc)
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in rc_params_from_file(fname, fail_on_error, use_default_template)
    866     """
--> 867     config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
    868 
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in _rc_params_in_file(fname, transform, fail_on_error)
    795     rc_temp = {}
--> 796     with _open_file_or_url(fname) as fd:
    797         try:
~\Anaconda3\lib\contextlib.py in __enter__(self)
    111         try:
--> 112             return next(self.gen)
    113         except StopIteration:
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in _open_file_or_url(fname)
    773             encoding = "utf-8"
--> 774         with open(fname, encoding=encoding) as f:
    775             yield f
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\QQ\\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-38-4356038cdce2> in <module>
----> 1 profile = ProfileReport(df2, title="Pandas Profiling Report")
~\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)
    125                     "{!r} not found in the style library and input is not a "
    126                     "valid URL or path; see `style.available` for list of "
--> 127                     "available styles".format(style)) from err
    128 
    129 
OSError: 'C:\\Users\\QQ\\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
回答列表
- 
            2020/08/03 下午 02:10Jeffrey贊同數:0不贊同數:0留言數:1
需要先安裝庫啊:
(1) !
pip install pandas-profiling (Notebook)(2)conda install -c conda-forge pandas-profiling - 
            2020/08/04 下午 01:31張維元 (WeiYuan)贊同數:0不贊同數:0留言數:1
嗨,錯誤看起來是有安裝,但有一些設定檔跑掉。有可能是版本造成的影響,建議刪掉重裝。
如果這個回答對你有幫助請主動點選「有幫助」或「最佳解答」的按鈕,也可以追蹤我的GITHUB 帳號。若還有問題的話,也歡迎再開一個新的問題繼續發問,或者把你理解的部分整理上來,我都會提供你 Review 和 Feedback 😃😃😃另外我目前有舉辦一個社群活動:學員限定!CUPOY 馬拉松線上小聚 👨🏻💻👨🏻💻,歡迎一起來玩玩!
 
