LoginSignup
0
1

More than 1 year has passed since last update.

データ形式変換

Posted at

エラー内容

DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().

自前のCSVを学習に用いたときに目的変数の型が少し違っていて警告されました。
これでも結果が出ているので大丈夫ですが、念のため警告が出ないように(500,1)→(500,)
のように変換してあげます。

コード

np.ravel(data[:, 0:1])
簡単ですがnumpyのravelを使用して[]を外してあげました。
これで警告は出なくなります。

初歩的ですがメモとして書かせていただきました。

0
1
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
1