如何将数据框中的事务列分隔到不同的列(日、月、时间、年)?

How to separate a transaction column in a dataframe to different columns(day,month,time, year)?

Column is in this format :  Wed Dec 26 09:06:00 IST 2018

我想在 python

中按日期、月份、时间、时区、年份等列进行分隔

您可以使用带 expand=True 的 str.split 方法。 确保重命名列。

df = pd.DataFrame({'col': ["Wed Dec 26 09:06:00 IST 2018"]})
df = df.col.str.split(expand=True)
df.columns = ['Day','Month','Day of month', 'Time','Time zone','Year']
df
   Day Month Day of month      Time Time zone  Year
0  Wed   Dec           26  09:06:00       IST  2018