我有一个这种形式的 Pandas 数据框:
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
Value
中值的 dtype 是 float。
我正在使用 seaborn 来漂浮它:
sns.lineplot(x='Year', y='Value', hue='Country', data=topfiveot)
出现错误:
DataError: No numeric types to aggregate
可能是什么导致了这个问题?
最佳答案
我认为这个错误更多地与 pandas.groupby() 有关,而不是与 seaborn 本身有关。检查以确保我所有的数字列都是 float 对我有用。在你的情况下
df.Year = df.Year.astype(float)
和
df.Values = df.Values.astype(float)
关于python - Seaborn 的 No numeric types to aggregate 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54374515/