I have looked at this reference so please do not refer me to it.
Find max number in .CSV file in Python I struggled to modify this code to my own document for over an hour with no results. The best I got from that code was printing out maximum value, and I got 0, which is incorrect. I need to 1) find the maximum value in column F, (38,332,521) and 2) print out the state associated with the maximum value (California).
Here is the csv I'm using: https://drive.google.com/open?id=0B29hT1HI-pwxMjBPQWFYaWoyalE
This is the code I've come up with myself, any help/feedback would be appreciated!
def largestState():
INPUT = "statepopulations.csv"
COLUMN = 5 # 6th column
with open(INPUT, "rU") as csvFile:
theFile = csv.reader(csvFile)
header = next(theFile, None) # skip header row
pop = [float(row[COLUMN]) for row in theFile]
max_pop = max(pop)
print max_pop
largestState()