I am working with a csv file with 3 columns that looks like this:
timeStamp, value, label
15:22:57, 849, CPU pid=26298:percent
15:22:57, 461000, JMX MB
15:22:58, 28683, Disks I/O
15:22:58, 3369078, Memory pid=26298:unit=mb:resident
15:22:58, 0, JMX 31690:gc-time
15:22:58, 0, CPU pid=26298:percent
15:22:58, 503000, JMX MB
The label
column contains distinct values (say a total of 5), which include spaces, colons and other special characters.
What I am trying to achieve is to plot time against each metric (either on the same plot or on separate ones). I can do this with matplotlib
, but I first need to group the [timeStamps, value]
pairs according to the 'label'.
I looked into the csv.DictReader
to get the labels and the itertools.groupby
to group by the 'label', but I am struggling to do this in a proper 'pythonic' way.
Any suggestion?