date拆分成单独的列
原数据data[‘date_time’]:
date_time ....other columns
2012-01-01 00:00:00 ... ...
2012-01-01 00:15:00 ... ...
... ... ... ...
2014-12-31 23:30:00 ... ...
2014-12-31 23:45:00 ... ...
将“年月日时分秒”全部拆分为单独的列
将data[‘date_time’]拆分
import numpy as np
import time
s=time.time()
#按照自己date_time的格式设置format
new_data = pd.to_datetime(data['0'], format="%Y-%m-%d %H:%M:%S")
#插入每一列
data.insert(0,'second',new_data.dt.second)
data.insert(0,'minute',new_data.dt.minute)
data.insert(0,'hour',new_data.dt.hour)
data.insert(0