On 27/01/2015 18:20, Danny Yoo wrote:
On Tue, Jan 27, 2015 at 5:04 AM, Tammy Miller <tgmill...@hotmail.com> wrote:
I have a csv file. I would like to create a filter or if statement on a column but
it is not producing the right results. It displays everythingHere is the
example:import csvwith open('test.csv') as csvfile: reader =
csv.DictReader(csvfile)for row in reader: if row['Absent'] > 10 print
rowI just want the column Absent to show me all of the numbers that are greater
than 10. It gives me all the results. I am not sure what to do.
Hi Tammy,
Ah. Take a look at the following:
########################
'foo' > 10
True
########################
Meanwhile in the non-Luddite world of Python 3.
>>> 10 > '10'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() > str()
>>> '10' > 10
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: str() > int()
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor