plot graph from data

breamoreboy at gmail.com breamoreboy at gmail.com
Mon Apr 24 10:21:51 EDT 2017


On Monday, April 24, 2017 at 12:51:26 PM UTC+1, Prasenjit Dutta wrote:
> Hi All,
> 
> I have a exported data as below:
> 
>  [2J [HNAME                                 CPU %               MEM USAGE / LIMIT
> goofy_wozniak                        0.53%               256.8 MiB / 7.64 GiB
> kibana.1.i5shzj5kc7ck4x6s6s3m3wxjl   0.00%               597.2 MiB / 7.64 GiB
> agitated_bhaskara                    0.00%               2.883 MiB / 7.64 GiB
> influxsrv                            0.09%               21.83 MiB / 7.64 GiB
> artifactoryTemp                      0.16%               866.7 MiB / 7.64 GiB
> artifactory-5.0.0                    0.43%               548 MiB / 7.64 GiB
> naughty_allen                        0.10%               94.55 MiB / 7.64 GiB
>  [2J [HNAME                                 CPU %               MEM USAGE / LIMIT
> goofy_wozniak                        0.53%               256.8 MiB / 7.64 GiB
> kibana.1.i5shzj5kc7ck4x6s6s3m3wxjl   0.00%               597.2 MiB / 7.64 GiB
> agitated_bhaskara                    0.00%               2.883 MiB / 7.64 GiB
> influxsrv                            0.09%               21.83 MiB / 7.64 GiB
> artifactoryTemp                      0.16%               866.7 MiB / 7.64 GiB
> artifactory-5.0.0                    0.43%               548 MiB / 7.64 GiB
> naughty_allen                        0.10%               94.55 MiB / 7.64 GiB
>  [2J [HNAME                                 CPU %               MEM USAGE / LIMIT
> goofy_wozniak                        0.53%               256.8 MiB / 7.64 GiB
> kibana.1.i5shzj5kc7ck4x6s6s3m3wxjl   0.00%               597.2 MiB / 7.64 GiB
> agitated_bhaskara                    0.00%               2.883 MiB / 7.64 GiB
> influxsrv                            0.03%               21.83 MiB / 7.64 GiB
> artifactoryTemp                      0.37%               866.7 MiB / 7.64 GiB
> artifactory-5.0.0                    0.75%               548 MiB / 7.64 GiB
> naughty_allen                        0.10%               94.55 MiB / 7.64 GiB
>  [2J [HNAME                                 CPU %               MEM USAGE / LIMIT
> goofy_wozniak                        1.30%               256.8 MiB / 7.64 GiB
> kibana.1.i5shzj5kc7ck4x6s6s3m3wxjl   0.00%               597.2 MiB / 7.64 GiB
> agitated_bhaskara                    0.00%               2.883 MiB / 7.64 GiB
> influxsrv                            0.03%               21.83 MiB / 7.64 GiB
> artifactoryTemp                      0.37%               866.7 MiB / 7.64 GiB
> artifactory-5.0.0                    0.75%               548 MiB / 7.64 GiB
> naughty_allen                        0.28%               94.55 MiB / 7.64 GiB
> 
> 
> Want to plot graph from this. Issue what i am facing is header name " [2J [HNAME                                 CPU %               MEM USAGE / LIMIT" repeating in between and also data is in text not in csv/xls
> 
> Can anyone help?
> 
> Thanks,
> Prasenjit

Open the file, loop to read it line by line and ignore any lines holding the header.  It seems to be fixed width data so it should be easy be read the data taking slices of the line and using string methods, maybe a regex if you prefer that kind of thing.  matplotlib https://matplotlib.org/ will do the plotting. 

Kindest regards.

Mark Lawrence.



More information about the Python-list mailing list