一、问题描述
在我们利用seaborn作图时,遇到了问题:
AttributeError: module 'seaborn' has no attribute 'factorplot'

二、问题的解决
2.1 初步尝试
这种情况最开始以为是 Python 库的版本问题,我用的Python环境里的 seaborn 版本为 0.12.1。
解决方法:更新一下 seaborn 库,在终端里面输入 pip install -U seaborn 升级:
即:
pip install -U seaborn -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

但是问题并没有得到解决!
2.2 最终的解决
factorplot已经更为catplot:
sns.catplot(x = 'Pclass', y = 'Survived', hue = 'Sex', data = data, kind = 'point')
问题得到解决:

文章讲述了在使用seaborn作图时遇到的AttributeError,提示seaborn模块没有factorplot属性。作者首先尝试通过更新seaborn库来解决问题,但问题依然存在。最终,作者发现factorplot已被替换为catplot,使用sns.catplot成功解决了问题。
3859

被折叠的 条评论
为什么被折叠?



