我在sublime文本编辑器中遇到了seaborn的问题.
import pandas as pd
import seaborn as sns
data = pd.read_csv('train.csv')
sns.factorplot('Sex', data=data)
这是错误:
Error
File "C:\Anaconda\lib\site-packages\numpy\core\_methods.py", line 73, in _mean
ret = ret / rcount
TypeError: unsupported operand type(s) for /: 'str' and 'long'
解决方法:
正如Arshad在评论中所说,只需在命令中添加kind =“count”,就可以解决问题.在这种情况下,代码应如下所示.
import pandas as pd
import seaborn as sns
data = pd.read_csv('train.csv')
sns.factorplot('Sex', data=data, kind="count")