1
votes

I am having an issue with seaborn in the sublime text editor.

import pandas as pd 
import seaborn as sns

data = pd.read_csv('train.csv')
sns.factorplot('Sex', data=data)

Here is the error:

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'
2
It says what's wrong right there: your did not convert the strings read from the CSV to numbers - Marcus Müller
sns.factorplot('Sex', data= data, kind="count") - Arshad Khan
i found the answere in seaborn 0.6 we need to add one more parameter sns.factorplot('Sex', data= data, kind="count") i got out of compilation error i am still unable to see factorplot please help after i run the code nothing is showing in sublime text editor - Arshad Khan

2 Answers

5
votes

As Arshad said in the comments, by just adding kind="count" to the command, it solves the issue. In this case, the code should look like the following.

import pandas as pd 
import seaborn as sns

data = pd.read_csv('train.csv')
sns.factorplot('Sex', data=data, kind="count")
0
votes

UserWarning: The factorplot function has been renamed to catplot. The original name will be removed in a future release. Please update your code. Note that the default kind in factorplot ('point') has changed 'strip' in catplot. warnings.warn(msg). Hence I used: sns.catplot('Sex',data=titanic_df,kind='count') and it works for me.