[英]Pandas plotting with multiple index labels
I have a pandas DataFrame that looks something like this: 我有一个像这样的pandas DataFrame:
n=pd.DataFrame({1:[1,2,np.NAN,4],2:[5,6,5,8],'info':[5,6,8,7],'moreinfo':[1,2,5,8]}).set_index(['info','moreinfo'])
Which looks like this: 看起来像这样:
1 2
info moreinfo
5 1 1.0 5
6 2 2.0 6
8 5 NaN 5
7 8 4.0 8
How can I line plot this such that: 我该如何绘制这样的图:
The column labels are used as the xlabels 列标签用作xlabels
The data is grouped and colored by index 数据按索引分组和着色
The y-axis is the numerical data found within each column. y轴是在每列中找到的数值数据。
Below is an example of what I'm thinking the plot should look like: 下面是我认为情节应该是这样的例子:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.