我得到了很多数据,比如:
a0:86:c6:52:4e:e8,0.006568,0.006620,Out
a0:86:c6:52:4e:e8,0.006663,0.006695,In
a0:86:c6:52:4e:e8,0.008089,0.008141,Out
a0:86:c6:52:4e:e8,0.008185,0.008217,In
01:00:5e:00:00:fb,0.033096,0.035016,Out
33:33:00:00:00:fb,0.034997,0.037077,Out
01:00:5e:7f:ff:fa,0.039969,0.042057,Out
ff:ff:ff:ff:ff:ff,0.059823,0.061639,Out
a0:86:c6:52:4e:e8,0.068865,0.068917,Out
a0:86:c6:52:4e:e8,0.068962,0.068994,In
a0:86:c6:52:4e:e8,0.083492,0.083544,Out
a0:86:c6:52:4e:e8,0.083588,0.083620,In
...
实际上,它持续120秒。我想用matplotlib把这些数据绘制成甘特图。
原因是大多数甘特图api只支持时间格式YY-MM-DD HH:MM:SS
,而不支持这么小(微秒)的大小。
请告诉我怎么做?
为了在matplotlib中生成甘特图,可以使用^{} 函数。matplotlib页上有a ^{} example 。
为了过滤和分组数据,可以使用pandas,特别是dataframe的
groupby
函数。下面是一个完整的示例:
它产生了以下情节:
相关问题 更多 >
编程相关推荐