0
0

More than 3 years have passed since last update.

numpy Loadtxtについて

Posted at

numpyのLoadtxtを利用する際に、海外OS(Spanish)のせいか文字変換のエラーが発生

ValueError: could not convert string to float: '235.00 ;591.00 '

元のコード train = np.loadtxt("XXXXXXXXXX", delimiter=',', skiprows=1)

色々と調べたところ、file Pathの前にrの追加とdelimiterを;に変更することで解決

修正後のコード train = np.loadtxt(r'XXXXXXXXX', delimiter=';', skiprows=1)

海外OSでは、地味にcsvファイルを扱う際に色々と気を付けないといけないことを実感しました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0