Convert Integers of different columns date and time to datetime python

Viewed 34
data.columns=['name','date','time','open','high','low','close','volume','oi']
data['date']=pd.to_datetime(data['date'],format='%Y%m%d')
data['time']=pd.to_datetime(data['time'])

        name       date                time  ...  volume  oi  candle
0  BANKNIFTY 2021-01-01 2022-09-07 09:16:00  ...       0   0   green
1  BANKNIFTY 2021-01-01 2022-09-07 09:17:00  ...       0   0     red
2  BANKNIFTY 2021-01-01 2022-09-07 09:18:00  ...       0   0   green
3  BANKNIFTY 2021-01-01 2022-09-07 09:19:00  ...       0   0   green
4  BANKNIFTY 2021-01-01 2022-09-07 09:20:00  ...       0   0   green

above is the output for the code I need it in the format of ddmmyyhm

below is the raw data

   BANKNIFTY  20210101  09:08  31297.30  ...  31297.30.2  31297.30.3  0  0.1
0  BANKNIFTY  20210101  09:16  31279.85  ...    31243.60    31337.25  0    0
1  BANKNIFTY  20210101  09:17  31337.70  ...    31309.75    31309.75  0    0
2  BANKNIFTY  20210101  09:18  31308.75  ...    31297.10    31315.85  0    0
3  BANKNIFTY  20210101  09:19  31317.90  ...    31317.90    31343.70  0    0
4  BANKNIFTY  20210101  09:20  31342.45  ...    31328.15    31344.25  0    0

Any help is highly appreciated thanks in advance

0 Answers
Related