I am trying to learn Python and Numpy, so please bear with me. I am using numpy.genfromtxt to import a CSV file into a matrix. CSV is as follows:
Time(min),Nm,Speed,Power,Distance,Rpm,Bpm,interval,Altitude,Rate,Incline,Temp,PowerBalance,LeftTorqueEffectiveness,RightTorqueEffectiveness,getLeftPedalSmoothness,getRightPedalSmoothness,getCombinedPedalSmoothness,THb,SmO2,km
0.016666668,,4.3555064,0,0.002,0,118,1,684.3,0.0,0.0,14.71,50,-1.0,-1.0,-1.0,-1.0,-1.0,311.72,311.72
0.033333335,,4.3555064,20,0.002,0,119,1,684.3,0.0,0.0,14.71,50,-1.0,-1.0,-1.0,-1.0,-1.0,311.72,311.72
0.05,,4.444291,13,0.004,0,119,1,684.3,0.0,0.0,14.71,50,-1.0,-1.0,-1.0,-1.0,-1.0,311.72,311.72
Now I run:
matrixCsv = np.genfromtxt(open(csvFile, "rb"), delimiter=',', \
missing_values=0,skip_header=1,dtype=float,\
usecols=(0,2,3,4,5,6,7,8,9,10,11,17),names=True)
and I get:
[ (0.033333335, 4.3555064, 20.0, 0.002, 0.0, 119.0, 1.0, 684.3, 0.0, 0.0, 14.71, -1.0)
(0.05, 4.444291, 13.0, 0.004, 0.0, 119.0, 1.0, 684.3, 0.0, 0.0, 14.71, -1.0)
(0.06666667, 4.4781966, 16.0, 0.006, 0.0, 120.0, 1.0, 684.3, 0.0, 0.0, 14.71, -1.0)
...,
which to me looks like tuples encapsulated in an array. But why tuples? I understand that tiered arrays / matrices should be uniform and that numpy makes a tuple of heterogeneous data. But why is my data heterogeneous? I do not understand...