I use numpy's np.genfromtxt(FileName,delimiter=",",names=True)
to import a csv file into a numpy array. Everything seems to work fine, except that my header has names with a colon (e.g. Points:1
), but numpy sets the key for this data column without the colon (e.g. Points1
).
Why is this happening and is there any way to prevent it?
MWE
min.csv:
"Time", "Points:0", "Points:1"
0.0, 1.0, 2.0
3.0,4.0,5.0
script:
import numpy as np
data = np.genfromtxt("min.csv",delimiter=",",names=True)
print data
print data.dtype
output:
[( 0., 1., 2.) ( 3., 4., 5.)]
[('Time', '<f8'), ('Points0', '<f8'), ('Points1', '<f8')]