| | |
Need help!!!!
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2009
Posts: 7
Reputation:
Solved Threads: 0
hi, i'm new in python programming
i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) and here is the text file link
http://pages.cpsc.ucalgary.ca/~zongpeng ... rades1.txt
any help would be appreciated
i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) and here is the text file link
http://pages.cpsc.ucalgary.ca/~zongpeng ... rades1.txt
any help would be appreciated
•
•
Join Date: Aug 2009
Posts: 55
Reputation:
Solved Threads: 13
0
#2 Nov 1st, 2009
Assuming you already know how to read in from files, there's a wonderful plotting tool for python called matplotlib that will let you make your pie chart. You'll have to get numpy first, though.
Btw, your link to the text file is broken.
Btw, your link to the text file is broken.
Last edited by Mathhax0r; Nov 1st, 2009 at 6:02 am.
0
#3 Nov 1st, 2009
try using link at the top toolbar of your editor. Very helpful to post links.
As buddy said, Matplotlib+wxPython will give you total control. If you do simple plotting, then wxPython have tool for that.
Anyway what do yo want to do with grades? May be python-mysql+wxPython+Matplotlib is all you need
As buddy said, Matplotlib+wxPython will give you total control. If you do simple plotting, then wxPython have tool for that.
Anyway what do yo want to do with grades? May be python-mysql+wxPython+Matplotlib is all you need
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
•
•
Join Date: Nov 2009
Posts: 7
Reputation:
Solved Threads: 0
0
#4 Nov 1st, 2009
unfortunatly i'm only allowed to use quickdraw,
i'm only struggling in figuring out how to extract the data from the txt file and assign the numbers to grades ,count how many scored each grade, i know how to make the chart (A1)
http://pages.cpsc.ucalgary.ca/~zongp...A3/grades1.txt
any help or tips would be appreciated
i'm only struggling in figuring out how to extract the data from the txt file and assign the numbers to grades ,count how many scored each grade, i know how to make the chart (A1)
http://pages.cpsc.ucalgary.ca/~zongp...A3/grades1.txt
any help or tips would be appreciated
Last edited by Ri0o; Nov 1st, 2009 at 7:18 am.
0
#5 Nov 1st, 2009
Ok, do us a favour,
attach that file to your post. Jus Click reply and you will see button to attach and do it. We cant know the content of the file!
Do it please
attach that file to your post. Jus Click reply and you will see button to attach and do it. We cant know the content of the file!
Do it please
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
0
#6 Nov 1st, 2009
I missed the Link to the file.
As far as I can see, you need to look at csv module to help you to do it.
What I propose is:
1. Open file
2. Get contents of one line
3. get that line with delimiter set to space ie ' '
4. Do whatever you want with data
NB: you can print the result to see what it produces before you use the data. Remember to use:
More links:
http://docs.python.org/library/csv.html
http://www.velocityreviews.com/forum...sv-reader.html
http://tinyurl.com/yf3pqka
Hope it helps
As far as I can see, you need to look at csv module to help you to do it.
What I propose is:
1. Open file
2. Get contents of one line
3. get that line with delimiter set to space ie ' '
4. Do whatever you want with data
NB: you can print the result to see what it produces before you use the data. Remember to use:
python Syntax (Toggle Plain Text)
csv.reader(open('grades1.txt'), delimiter=' ')
More links:
http://docs.python.org/library/csv.html
http://www.velocityreviews.com/forum...sv-reader.html
http://tinyurl.com/yf3pqka
Hope it helps
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
0
#7 Nov 1st, 2009
Actually. your raw data file is tab delimited and easily converted into a list of lists. Once that is done you can simply access your specific data by index and looping through the list.
The only special considerations are that the first line is a header and the last line is an 'end of file' marker.
The only special considerations are that the first line is a header and the last line is an 'end of file' marker.
May 'the Google' be with you!
•
•
Join Date: Nov 2009
Posts: 7
Reputation:
Solved Threads: 0
0
#8 Nov 1st, 2009
•
•
•
•
hi, i'm new in python programming
i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) .
http://pages.cpsc.ucalgary.ca/~zongp...ents/A3/a3.pdf
any help would be appreciated
![]() |
Other Threads in the Python Forum
- Previous Thread: Catching Clicks on Icons
- Next Thread: Simple Graphics Window
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog data decimals dictionaries dictionary drive dynamic error examples excel exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable wikipedia windows write wxpython xlib






