Re: [Tutor] Using if statement with csv file

2015-01-28 Thread Mark Lawrence
On 27/01/2015 22:40, dw wrote: Hi Tammy, I wonder how big your csv file is? I have ever read a small csv file into one variable. Even a csv file with 100 rows. And then split it into identified fields from there. I look at the csv file with Notepad++ to see if the data rows end with a \r or a \n.

Re: [Tutor] Using if statement with csv file

2015-01-28 Thread Alan Gauld
On 27/01/15 22:40, dw wrote: I have ever read a small csv file into one variable. Even a csv file with 100 rows. And then split it into identified fields from there. I look at the csv file with Notepad++ to see if the data rows end with a \r or a \n. I then split that into a list and each row is

Re: [Tutor] Using if statement with csv file

2015-01-28 Thread dw
Hi Tammy, I wonder how big your csv file is? I have ever read a small csv file into one variable. Even a csv file with 100 rows. And then split it into identified fields from there. I look at the csv file with Notepad++ to see if the data rows end with a \r or a \n. I then split that into a list an

Re: [Tutor] Using if statement with csv file

2015-01-27 Thread Matthew Ruffalo
On 01/27/2015 08:04 AM, Tammy Miller 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)f

Re: [Tutor] Using if statement with csv file

2015-01-27 Thread Mark Lawrence
On 27/01/2015 18:20, Danny Yoo wrote: On Tue, Jan 27, 2015 at 5:04 AM, Tammy Miller 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 csv

Re: [Tutor] Using if statement with csv file

2015-01-27 Thread Danny Yoo
> > In your code, you are comparing a string (an element of your CSV row) > with a number. Whoops, forgot to include recommendations. You probably do not want to have comparisons of mixed type. As we have found, the result we get back is arbitrary and capricous. Rather, we probably want to comp

Re: [Tutor] Using if statement with csv file

2015-01-27 Thread Danny Yoo
On Tue, Jan 27, 2015 at 5:04 AM, Tammy Miller 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

Re: [Tutor] Using if statement with csv file

2015-01-27 Thread Alan Gauld
On 27/01/15 13:04, Tammy Miller 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 r

[Tutor] Using if statement with csv file

2015-01-27 Thread Tammy Miller
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 prin