I need help with graphs in python (2.7.3.1)

Guest

Hi there, I hope that there is someone willing to help me out, I need to generate a graph in Python 2.7.3.1, but I am not that skilled with Python and I am completely stuck

I had to make a .CSV file from my Windows system logs (already did that), and the following steps must bw written in the form of a Python 2.7.3.1 script.

These are some steps I need to do first before creating the graph:
- Get the name of a CSV file from an ini file,
- Next, read a line from this CSV file,
- Increase a variable depending on the Log level (information, warning, error, critical),
- Read the next line,
- Then I need to print these results in a Graph.

I really hope that there is someone there to help me out, and many thanks in advance for all your help!

Advertisements

Most of the tasks you have to do can be achieved quite easily with the
standard library (except the plotting).

On Tue, Dec 18, 2012 at 03:29:49AM -0800, wrote:
> These are some steps I need to do first before creating the graph:
> - Get the name of a CSV file from an ini file,
Have a look at the ConfigParser module[1],
> - Next, read a line from this CSV file,
well, the csv module[2] apparently is a good choice for that,
> - Increase a variable depending on the Log level (information,
> - warning, error, critical),
you maybe want to use collections.counter for that[3]. Anyways, I
think matplotlib can handle the counting for youâ€¦
> - Read the next line,
this is just iteration over the csv instance you created with your file
> - Then I need to print these results in a Graph.
I use matplotlib for this purpose, have a look at their gallery[4] to
decide what kind of plot best fits your needs.

I'd recommend to install ipython and start playing around with the
modules I just told you. If you are stuck somewhere read the
documentation properly (it's actually all in there) and come back
again if you cannot come up with a solution.

Advertisements

On 12/18/2012 6:29 AM, wrote:
> Hi there, I hope that there is someone willing to help me out, I need
> to generate a graph in Python 2.7.3.1,

There is only 2.7.3, no 2.7.3.1, at least not officially.
> I had to make a .CSV file from my Windows system logs (already did
> that), and the following steps must bw written in the form of a
> Python 2.7.3.1 script.
>
> These are some steps I need to do first before creating the graph: -
> Get the name of a CSV file from an ini file, - Next, read a line from
> this CSV file, - Increase a variable depending on the Log level
> (information, warning, error, critical), - Read the next line, - Then
> I need to print these results in a Graph.

It sounds like your data consist of 4 counts. If so, you can easily make
a simple bar plot with characters

On Tue, 18 Dec 2012 13:20:25 +0100, Thomas Bach
<-mainz.de> declaimed the following in
gmane.comp.python.general:
> Hi,
>
> Most of the tasks you have to do can be achieved quite easily with the
> standard library (except the plotting).
>
Since it sounds like the output is going to be a bar-chart, even
that could be done with the standard library... Based on the counts,
set the highest count to map to, say 60 (characters), scale the other
counts proportionately, then generate a display of (use fixed pitch)

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!