LoginSignup
0
0

More than 1 year has passed since last update.

日付データから年、月、日を抽出

Posted at

やること

  • datetimeのインポート
  • to_datetimeで文字列型を日付型に変換
  • .dtで抽出

コード

title
import datetime

train_df["match_date"] = pd.to_datetime(train_df["match_date"])
train_df["year"] = train_df["match_date"].dt.year
train_df["month"] = train_df["match_date"].dt.month
train_df["day"] = train_df["match_date"].dt.day

参考にしたサイト

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