Guest User

Untitled

a guest
Jun 17th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. How to open a CSV,read a particular header of column and get the highest value
  2. import csv
  3. col_name = "name"
  4. with open("file.csv", "rb") as f:
  5. reader = csv.reader(f)
  6. col_index = next(reader).index(col_name)
  7. highest = max(rec[col_index] for rec in reader)
Advertisement
Add Comment
Please, Sign In to add comment