Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import numpy
- def load_to_dict(filename):
- dictionary = {}
- with open(filename,"r") as file:
- x = csv.reader(file,delimiter=',')
- for row in x:
- array = []
- for i in range(1,len(row)):
- array.append(int(row[i]))
- if row[0] == 'country':
- dictionary.__setitem__('Time',numpy.array(array))
- else:
- dictionary.__setitem__(row[0],numpy.array(array))
- return dictionary
- i = load_to_dict("income_per_person.csv")
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement