一、问题描述
在我们利用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')
问题得到解决: