I am trying to classify a data set with 21 columns and a lot of rows. I've gotten to the point where I can import the data as a csv and print out seperate columns. There are two things I have left to do. First I want to be able to print out specific data points. For example the data point that is located in row 2 column 4. The second task is to classify the rows of data based off of columns 4 and 5. These columns are latitude and longitude. and I am trying to get rows that are in a specific part of the world. so my idea to do this was this
if 60 > row[4] > 45 and 165 > row[1] > 150:
ie( so like the math operation (9 > x > 5))
I'm not sure what the proper way to do the above procedure is.
I have pasted the code to the bottom. I am new to programming in python so feel free to point out errors.
import csv
path = r'C:\Documents and Settings\eag29278\My Documents\python test code\test_satdata.csv'
with open(path, 'rb') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
print row [0]
#this prints out the first column
var1 = []
for row in f:
if 60 > row[4] > 45 and 165 > row[1] > 150:
var1.append(row)
print var1
UPDATE 1
okay so i updated the code but when i run the module i get this output..
2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 []
so I see that the program prints out var1 but it is empty