LoginSignup
4
3

More than 5 years have passed since last update.

25時表記の時刻データの変換

Posted at

深夜のテレビ番組などは25時、26時スタートなどの表記をされることがある。
扱っているデータが、日付の文字列と25時表記の時刻で持っていたので、DateTime形式への変換方法をメモしておく。

test.py
df["日時"] = pd.to_datetime(df["日付"]) + pd.to_timedelta(df["時刻"])

時刻をTimedelta形式にすることで、25時表記の時刻を25時間(1日と1時間)と扱い、datetimeに足し合わせた。

余談

25時表記のことを何と呼べばいいのだろう。。

4
3
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
4
3