'Pd Series datetime convert to datetime in format

I have a series of date and time data in one column , cannot figure it out how to change timestamp to datetime in format given (from %Y/%m/%d %H:%M:$S.%f to %Y/%m/%d %H:%M), what I'm showing below are my sheet ,code, outcome and my attempts.

Here's the data

enter image description here

I have this

dataset_train =  pd.read_excel('2btc_usdt.xlsx',sheet_name=0)
datelist_train = list(dataset_train['datetime'])
print(datelist_train)

Outcome

[Timestamp('2017-08-17 13:00:00'), Timestamp('2017-08-17 14:00:00'),
 Timestamp('2017-08-17 15:00:00.005000'), Timestamp('2017-08-17 16:00:00.010000'), Timestamp('2017-08-17 17:00:00.015000'), Timestamp('2017-08-17 18:00:00.020000'), 
Timestamp('2017-08-17 19:00:00.025000'), Timestamp('2017-08-17 20:00:00.030000'), Timestamp('2017-08-17 21:00:00.035000'), Timestamp('2017-08-17 22:00:00.040000'), Timestamp('2017-08-17 23:00:00.045000'), Timestamp('2017-08-18 00:00:00.050000'), 
Timestamp('2017-08-18 01:00:00.055000'), Timestamp('2017-08-18 02:00:00.060000'), Timestamp('2017-08-18 03:00:00.065000'), Timestamp('2017-08-18 04:00:00.070000'), Timestamp('2017-08-18 05:00:00.075000'), Timestamp('2017-08-18 06:00:00.080000'), Timestamp('2017-08-18 07:00:00.085000'), Timestamp('2017-08-18 08:00:00.090000'), 
Timestamp('2017-08-18 09:00:00.095000'), Timestamp('2017-08-18 10:00:00.100000'), Timestamp('2017-08-18 11:00:00.105000'), Timestamp('2017-08-18 12:00:00.110000'), Timestamp('2017-08-18 13:00:00.115000'), Timestamp('2017-08-18 14:00:00.120000'), 
Timestamp('2017-08-18 15:00:00.125000'), Timestamp('2017-08-18 16:00:00.130000'), Timestamp('2017-08-18 17:00:00.135000'), Timestamp('2017-08-18 18:00:00.140000'), Timestamp('2017-08-18 19:00:00.145000'), Timestamp('2017-08-18 20:00:00.150000'), 
Timestamp('2017-08-18 21:00:00.155000'), Timestamp('2017-08-18 22:00:00.16..............

What I have tried

#Attempt no1

datelist_train = list(dataset_train['date'])
datelist_train = [dt.datetime.strptime( date, "%Y/%m/%d %H:%M").date() for date in datelist_train]
#it just convert list to series and not changing the format

#Attempt no2
datelist_train = list(dataset_train['datetime'])
datelist_train = pd.to_datetime(datelist_train,unit='ms')
#i get message: unit='ms' not valid with non-numerical val='2017-08-17 13:00:00'


Solution 1:[1]

Tried out your problem and below code solved it:

dataset_train = pd.read_excel(r'C:\Users\Downloads\Book 1.xlsx', sheet_name=0 )
print((dataset_train['timestamp']))
dataset_train['DATE'] = dataset_train['timestamp'].apply(lambda x: x.strftime('%Y/%m/%d %H:%M'))
print(dataset_train['DATE'])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Henry Ecker