【发布时间】:2021-03-05 23:15:54
【问题描述】:
我正在尝试将以下数据框绘制成条形图:
JP_genre JP_sales
0 Action 159.95
1 Adventure 52.07
2 Fighting 87.35
3 Misc 107.76
4 Platform 130.77
5 Puzzle 57.31
6 Racing 56.69
7 Role-Playing 352.31
8 Shooter 38.28
9 Simulation 63.70
10 Sports 135.37
11 Strategy 49.46
当我输入以下代码时:
JP_df.plot(x = 'JP_genre', y = 'JP_sales', kind= 'bar')
我得到了错误
TypeError: no numeric data to plot
知道为什么会这样吗?
【问题讨论】:
-
会不会是 JP_sales 列是字符串而不是浮点数?
-
我重新创建了 excel 表并尝试了您的功能,它按预期工作。
标签: python dataframe matplotlib