AttributeError: module ‘seaborn‘ has no attribute ‘tsplot‘

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AttributeError: module ‘seaborn‘ has no attribute ‘tsplot‘相关的知识,希望对你有一定的参考价值。

AttributeError: module 'seaborn' has no attribute 'tsplot'

问题:

g = sns.tsplot(df['pm2.5'])

plt.figure(figsize=(5.5, 5.5))
g = sns.tsplot(df['pm2.5'])
# lineplot
g.set_title('Time series of pm2.5')
g.set_xlabel('Index')
g.set_ylabel('pm2.5 readings')

解决:

g = sns.lineplot(df['pm2.5'])

plt.figure(figsize=(5.5, 5.5))
g = sns.lineplot(df['pm2.5'])
# lineplot
g.set_title('Time series of pm2.5')
g.set_xlabel('Index')
g.set_ylabel('pm2.5 readings')

完整错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-7d4bb0e8da02> in <module>
      1 plt.figure(figsize=(5.5, 5.5))
----> 2 g = sns.tsplot(df['pm2.5'])
      3 g.set_title('Time series of pm2.5')
      4 g.set_xlabel('Index')
      5 g.set_ylabel('pm2.5 readings')

AttributeError: module 'seaborn' has no attribute 'tsplot'

<Figure size 396x396 with 0 Axes>

This release also removes a few previously-deprecated features:

The tsplot function and seaborn.timeseries module have been removed. Recall that tsplot was replaced with lineplot().

The seaborn.apionly entry-point has been removed.

The seaborn.linearmodels module (previously renamed to seaborn.regression) has been removed.

refer to:https://seaborn.pydata.org/whatsnew.html

参考:AttributeError: module 'seaborn' has no attribute 'tsplot'

参考:seaborn

以上是关于AttributeError: module ‘seaborn‘ has no attribute ‘tsplot‘的主要内容,如果未能解决你的问题,请参考以下文章

AttributeError:模块 'urllib' 没有属性 'parse'

tensorflow -----AttributeError: module ‘tensorflo

新的 Kivy 安装:AttributeError: 'module' 对象没有属性 'require'

类 InstagramSpider(scrapy.Spider): AttributeError: 'module' 对象没有属性 'Spider'

api = twitter.Api() AttributeError: 'module' 对象没有属性 'Api

安装pytest-allure-adaptor后,运行报错:AttributeError: module 'pytest' has no attribute 'allure&#