I'm starting to learn using Numpy and I have this CSV table:
,August,September,October,November,December,January
Johny,84,81.3,82.8,80.1,77.4,75.2
Dave,79.6,75.2,75,74.3,72.8,71.4
Ali,67.5,66.5,65.3,65.9,65.6,64
Bob,110.7,108.2,104.1,101,98.3,95.5
I have to get the raw numbers in an array and also the months and names as array of strings in a list.
I managed the first one but struggle finding the right way for the other two.
My code:
def load_training_data(filename):
data = np.genfromtxt(filename, delimiter=',',skip_header=1)
data = data[:, 1:]
column_names = np.asarray(np.genfromtxt(open(filename),delimiter=",",dtype=None)[:1])
column_names = column_names.dtype.names
row_names = np.array(filename)
return data,column_names,row_names