I want to read in a standard-ascii csv file into numpy, which consists of floats and strings.
E.g.,
ZINC00043096,C.3,C1,-0.1540,methyl
ZINC00043096,C.3,C2,0.0638,methylene
ZINC00043096,C.3,C4,0.0669,methylene
ZINC00090377,C.3,C7,0.2070,methylene
...
Whatever I tried, the resulting array would look like
E.g.,
all_data = np.genfromtxt(csv_file, dtype=None, delimiter=',')
[(b'ZINC00043096', b'C.3', b'C1', -0.154, b'methyl')
(b'ZINC00043096', b'C.3', b'C2', 0.0638, b'methylene')
(b'ZINC00043096', b'C.3', b'C4', 0.0669, b'methylene')
However, I want to save a step for the byte-string conversion and was wondering how I can read in the string columns as regular string directly.
I tried several things from the numpy.genfromtxt() documentation, e.g., dtype='S,S,S,f,S'
or dtype='a25,a25,a25,f,a25'
, but nothing really helped here.
I am afraid, but I think I just don't understand how the dtype conversion really works...Would be nice if you can give me some hint here!
Thanks