Applying an earlier genfromtxt answer to this case:
txt="""0.3,36.22683698,-115.0466482,1836.255238,0,0,0.2105903662,0.6848089322,41.15086807,2016/3/26,4:35:51
... ..."""
>>> load=np.genfromtxt(txt.splitlines(),dtype=None,delimiter=',')
>>> load.shape
(3,)
>>> load.dtype
dtype([('f0', '<f8'), ('f1', '<f8'), ('f2', '<f8'), ('f3', '<f8'), ('f4', '<i4'), ('f5', '<i4'), ('f6', '<f8'), ('f7', '<f8'), ('f8', '<f8'), ('f9', 'S9'), ('f10', 'S7')])
The shape is 1d, but the dtype is compound, a mix of floats, ints and strings - 11 of them.
>>> load[0]
(0.3, 36.22683698, -115.0466482, 1836.255238, 0, 0, 0.2105903662, 0.6848089322, 41.15086807, '2016/3/26', '4:35:51')
>>> load['f0']
array([ 0.3, 0.6, 0.9])
'rows' or records are accessed by number, but 'columns' are now fields, and accessed by name (you can get the names from csv column headers as well, here they are generated automatically).
>>> load[0]['f4']
0
>>> load[0]['f3']
1836.255238
Individual elements are access by a combination of number and name.
A disadvantage of this structured array format is that the ability to do math across columns is limited. A way around this is to group like columns into another layer of compounding.
With this data I can define 5 fields, a mix of float, int and string:
>>> dt=np.dtype('(4)float,(2)int,(3)float,S10,S10')
>>> dt
dtype([('f0', '<f8', (4,)), ('f1', '<i4', (2,)), ('f2', '<f8', (3,)), ('f3', 'S10'), ('f4', 'S10')])
>>> load=np.genfromtxt(txt.splitlines(),dtype=dt,delimiter=',')
Now the first field is a (3,4) array:
>>> load['f0']
array([[ 3.00000000e-01, 3.62268370e+01, -1.15046648e+02,
1.83625524e+03],
[ 6.00000000e-01, 3.62268370e+01, -1.15046648e+02,
1.83625524e+03],
[ 9.00000000e-01, 3.62268370e+01, -1.15046648e+02,
1.83625524e+03]])
>>> load['f1']
array([[0, 0],
[0, 0],
[0, 0]])
dt=np.dtype('(9)float,S10,S10') also works since the 2 int columns can load as floats.
The last 2 columns could be loaded as np.datetime64, though the comma separating them might complicate the step.
These 9 numeric columns can be extracted from a pandas load into a numpy float array with:
pload.values[:,:9].astype(float)
pload.as_matrix(range(9))
genfromtxtproducing a 1d array. Posters don't realize it has a compounddtype. Read aboutstructuredarrays.