问题
In the image shown, how can i split 'Date' column into 'Date' and 'Time' column?
'
回答1:
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
来源:https://stackoverflow.com/questions/42018180/how-can-i-split-date-column-into-date-and-time-column