0
'日付と時刻'の列に 'datetime'列を分割するにはどうすればいいですか? 私は、カラム1として '日付'を持ち、カラム2として '時間'を持っています。 残りのカラムは同じヘッダを持ちます。明らかに、日付時刻列の削除パンダの列を分割する方法
df['date'] = df['datetime'].dt.date
df['time'] = df['datetime'].dt.time
# optional, drop original column
df.drop('datetime', axis=1, inplace=True)
:列を想定し
datetime C H L O OI V WAP
0 2017-03-13 19:00:00 8.22 8.22 8.10 8.10 4 6 8.143
1 2017-03-13 19:01:00 8.22 8.22 8.22 8.22 0 0 8.220
2 2017-03-13 19:02:00 8.22 8.22 8.22 8.22 0 0 8.220
3 2017-03-13 19:03:00 8.22 8.22 8.22 8.22 0 0 8.220
4 2017-03-13 19:04:00 8.22 8.22 8.22 8.22 0 0 8.220
print(df.head())
new_date_and_time = lambda x : x.split()
df['new_date_and_time'] = df['datetime'].apply(new_date_and_time)
print(df.head())
[タイムスタンプ列を別々の日付と時刻列に分割する](http://stackoverflow.com/questions/35595710/splitting-timestamp-column-into-seperate-date-and-time-columns)の可能な複製 – chinskiy