Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35049 > unrolled thread
| Started by | hevymetl07@gmail.com |
|---|---|
| First post | 2012-12-18 03:29 -0800 |
| Last post | 2012-12-18 17:59 -0500 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
I need help with graphs in python (2.7.3.1) hevymetl07@gmail.com - 2012-12-18 03:29 -0800
Re: I need help with graphs in python (2.7.3.1) Thomas Bach <thbach@students.uni-mainz.de> - 2012-12-18 13:20 +0100
Re: I need help with graphs in python (2.7.3.1) Terry Reedy <tjreedy@udel.edu> - 2012-12-18 11:43 -0500
Re: I need help with graphs in python (2.7.3.1) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-18 17:59 -0500
| From | hevymetl07@gmail.com |
|---|---|
| Date | 2012-12-18 03:29 -0800 |
| Subject | I need help with graphs in python (2.7.3.1) |
| Message-ID | <ff5f2d01-7271-42ed-860f-ce2290967514@googlegroups.com> |
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!
[toc] | [next] | [standalone]
| From | Thomas Bach <thbach@students.uni-mainz.de> |
|---|---|
| Date | 2012-12-18 13:20 +0100 |
| Message-ID | <mailman.1016.1355833240.29569.python-list@python.org> |
| In reply to | #35049 |
Hi,
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, hevymetl07@gmail.com 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.
Hope this helps,
Thomas Bach.
Footnotes:
[1] http://docs.python.org/2/library/configparser.html
[2] http://docs.python.org/2/library/csv.html
[3] http://docs.python.org/2/library/collections.html#collections.Counter
[4] http://matplotlib.org/gallery.html
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2012-12-18 11:43 -0500 |
| Message-ID | <mailman.1022.1355849013.29569.python-list@python.org> |
| In reply to | #35049 |
On 12/18/2012 6:29 AM, hevymetl07@gmail.com 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 Log level Number Plot (x = 10) ---------- ------ ----------------------------------------------------- infomation 386 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx warning 97 xxxxxxxxxx error 5 x critical 23 xxx The main problem is to compute the scaling factor from the data. You also have to decide on the rounding (I rounded up). -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2012-12-18 17:59 -0500 |
| Message-ID | <mailman.1034.1355871578.29569.python-list@python.org> |
| In reply to | #35049 |
On Tue, 18 Dec 2012 13:20:25 +0100, Thomas Bach
<thbach@students.uni-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)
info | ********************
warn | *****************************************
error | *******
crit | **************
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web