How can i split 'Date' column into 'Date' and 'Time' column? [closed]

こ雲淡風輕ζ 提交于 2019-12-08 18:23:30

You can use str.split by whitespace what is default separator:

df = pd.DataFrame({'Date':['4/1/2016 0.00','4/2/2016 0.05']})
print (df)
            Date
0  4/1/2016 0.00
1  4/2/2016 0.05

df[['Date','Time']] = df.Date.str.split(expand=True)
print (df)
       Date  Time
0  4/1/2016  0.00
1  4/2/2016  0.05
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!