python - load a float+ string table -


this question has answer here:

i have table contains both floats , strings. when i'm trying load np.loadtxt(file.txt), got error

could not convert string float: \omega_b 

how can fix it.

you can load using dtype option create structured array:

np.loadtxt(fname, dtype=[('col1_name', '|s10'), ('col2_name', float)]) 

or if don't want specify dtypes should use can go suggested @atomh33ls: dtype=none.

see additional options np.loadtxt can tune needs.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -