Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seaborn's No numeric types to aggregate error

I have a pandas data frame in this form:

    Country     Year        Value
0   Thailand    1989       48587.03
1   Thailand    1990       55903.07
2   Vietnam     1989      100290.04
3   Vietnam     1990      118873.59
4   India       1989      147383.02
5   India       1990      178230.05

The dtype of the values in Value is float.

I am using seaborn to float this:

sns.lineplot(x='Year', y='Value', hue='Country', data=topfiveot)

And got an error:

DataError: No numeric types to aggregate

What possibly has caused the issue?

like image 859
Katie Avatar asked Jan 26 '19 00:01

Katie


1 Answers

I think this error has more to do with pandas.groupby() than with seaborn itself. Checking to make sure that all of my numeric columns were floats worked for me. In your case

df.Year = df.Year.astype(float) and df.Values = df.Values.astype(float)

like image 61
Augustin C Hennings Avatar answered Sep 20 '22 12:09

Augustin C Hennings