1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pandasで機械学習のトレーニングデータを目的変数とそれ以外に分割する方法

Last updated at Posted at 2020-10-04

データの読み込み(CSVファイルを想定)

import numpy as np
import pandas as pd

train = pd.read_csv('train.csv')

トレーニングデータを目的変数(target)とそれ以外に分割

# 目的変数を削除
train_x = train.drop("target",axis=1)
# 目的変数のみを取得
train_y = train["target"]
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?