首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用pandas_profiling格式时的TypeError

使用pandas_profiling格式时的TypeError
EN

Stack Overflow用户
提问于 2020-09-17 13:47:51
回答 1查看 798关注 0票数 2

我遵循pandas_profiling文档脚本,但是这个问题总是会出现。我的数据集是滑雪的波士顿。

我有报告,但没有html版本的特性:

代码语言:javascript
复制
profile2 = ProfileReport(data, title="Relatório DATASET -data-", html={'style': {'full_width': True}}, sort="None")

下面的图像引用了以下代码:

代码语言:javascript
复制
 from pandas_profiling import ProfileReport    
 profile = ProfileReport(data, title='Pandas Profiling Report', explorative=True)

我的pandas_profiling版本

如果我使用以下代码,则不会出现上述问题:

代码语言:javascript
复制
profile = ProfileReport (data)

更新:卸载了以前的版本并获得了新的版本(2.9.0),但是出现了以下问题:

代码语言:javascript
复制
  Summarize dataset: 75%
21/28 [00:07<00:02, 2.84it/s, Get scatter matrix]

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in _repr_html_(self)
    407     def _repr_html_(self):
    408         """The ipython notebook widgets user interface gets called by the jupyter notebook."""
--> 409         self.to_notebook_iframe()
    410 
    411     def __repr__(self):

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in to_notebook_iframe(self)
    387         with warnings.catch_warnings():
    388             warnings.simplefilter("ignore")
--> 389             display(get_notebook_iframe(self))
    390 
    391     def to_widgets(self):

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\notebook.py in get_notebook_iframe(profile)
     63         output = get_notebook_iframe_src(profile)
     64     elif attribute == "srcdoc":
---> 65         output = get_notebook_iframe_srcdoc(profile)
     66     else:
     67         raise ValueError(

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\notebook.py in get_notebook_iframe_srcdoc(profile)
     21     width = config["notebook"]["iframe"]["width"].get(str)
     22     height = config["notebook"]["iframe"]["height"].get(str)
---> 23     src = html.escape(profile.to_html())
     24 
     25     iframe = f'<iframe width="{width}" height="{height}" srcdoc="{src}" frameborder="0" allowfullscreen></iframe>'

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in to_html(self)
    357 
    358         """
--> 359         return self.html
    360 
    361     def to_json(self) -> str:

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in html(self)
    177     def html(self):
    178         if self._html is None:
--> 179             self._html = self._render_html()
    180         return self._html
    181 

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in _render_html(self)
    284         from pandas_profiling.report.presentation.flavours import HTMLReport
    285 
--> 286         report = self.report
    287 
    288         disable_progress_bar = not config["progress_bar"].get(bool)

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in report(self)
    171     def report(self):
    172         if self._report is None:
--> 173             self._report = get_report_structure(self.description_set)
    174         return self._report
    175 

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in description_set(self)
    152     def description_set(self):
    153         if self._description_set is None:
--> 154             self._description_set = describe_df(self.title, self.df, self._sample)
    155         return self._description_set
    156 

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\model\describe.py in describe(title, df, sample)
    100         # Scatter matrix
    101         pbar.set_postfix_str("Get scatter matrix")
--> 102         scatter_matrix = get_scatter_matrix(df, variables)
    103         pbar.update()
    104 

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\model\summary.py in get_scatter_matrix(df, variables)
    696             for y in continuous_variables:
    697                 if x in continuous_variables:
--> 698                     scatter_matrix[x][y] = scatter_pairwise(df[x], df[y], x, y)
    699     else:
    700         scatter_matrix = {}

C:\ProgramData\Anaconda3\lib\contextlib.py in inner(*args, **kwds)
     71         @wraps(func)
     72         def inner(*args, **kwds):
---> 73             with self._recreate_cm():
     74                 return func(*args, **kwds)
     75         return inner

C:\ProgramData\Anaconda3\lib\contextlib.py in __enter__(self)
    110         del self.args, self.kwds, self.func
    111         try:
--> 112             return next(self.gen)
    113         except StopIteration:
    114             raise RuntimeError("generator didn't yield") from None

C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\visualisation\context.py in manage_matplotlib_context()
     77         register_matplotlib_converters()
     78         matplotlib.rcParams.update(customRcParams)
---> 79         sns.set_style(style="white")
     80         yield
     81     finally:

AttributeError: module 'seaborn' has no attribute 'set_style'
EN

回答 1

Stack Overflow用户

发布于 2020-09-17 19:59:08

解决方案是团结/重新安装Anaconda和熊猫的特征。可能是保罗H在评论中提出的一些版本问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63939507

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档