Jul-25-2017, 02:33 PM
You should use the module csv:
You can do an inline sort of the list. If you want to have different sorted new lists, you should use the built-in function sorted().
import csv with open('world_temp_mean.csv') as fd: reader = csv.reader(fd) head = next(reader) data = list(reader)Now you have data, which is a list. Each element in the list is one row of the data.
You can do an inline sort of the list. If you want to have different sorted new lists, you should use the built-in function sorted().
from operator import itemgetter # avg highest tmp is in index 2 # sort by index 2 data.sort(key=itemgetter(2), reverse=True) # or with lambda data.sort(key=lambda x: x[2], reverse=True)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!