the*_*man 2 python dataframe pandas seaborn
我正在尝试分散以下数据框:
mydf = pd.DataFrame({'x':[1,2,3,4,5,6,7,8,9],
'y':[9,8,7,6,5,4,3,2,1],
'z':np.random.randint(0,9, 9)},
index=["12:00", "1:00", "2:00", "3:00", "4:00",
"5:00", "6:00", "7:00", "8:00"])
x y z
12:00 1 9 1
1:00 2 8 1
2:00 3 7 7
3:00 4 6 7
4:00 5 5 4
5:00 6 4 2
6:00 7 3 2
7:00 8 2 8
8:00 9 1 8
Run Code Online (Sandbox Code Playgroud)
我希望将时间"12:00,1:00,..."视为x轴和x,y,zy轴上的列.
当我尝试用pandas via绘图时mydf.plot(kind="scatter"),我得到了错误ValueError: scatter requires and x and y column.我是否必须将我的数据框分解为适当的参数?我真正想做的是用seaborn绘制这个散点图.
刚刚跑步
mydf.plot(style=".")
Run Code Online (Sandbox Code Playgroud)
对我来说很好:

| 归档时间: |
|
| 查看次数: |
5385 次 |
| 最近记录: |