I have a dataframe(Pandas), with a column representing dates, in the following format:
import pandas as pd
import tushare as ts
data = ts.get_tick_data('600030',date='2019-06-28',src='tt') [['time','price','change','volume','amount']]
print(data.head())
Specifically, I would like to use pd.to_datetime convert the 'time' column to datetime.
The code are:
import pandas as pd
import tushare as ts
data = ts.get_tick_data('600030',date='2019-06-28',src='tt') [['time','price','change','volume','amount']]
data.index=pd.to_datetime(data['time'])
del data['time']
print(data.head())
The results are as follow:
price