python - load a float+ string table -
this question has answer here:
- reading file string , float loadtxt 2 answers
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
Post a Comment