I have a data frame column, named date with the following values:
date
0 201801010000
1 201801010050
2 201801010150
3 201801010250
4 201801010300
5 201801010350
6 201801010450
7 201801010550
8 201801010600
9 201801010650
I want to convert it to date and time, so I used the following code:
df2['date'] = pd.datetime(df2['date'], format='%Y%m%d%H%M')
But, its giving me an error:
TypeError: an integer is required
I thought that I need to convert the column into integer so, I converted it as:
df2["date"] = df2.date.astype(int)
But, still I am getting the same error. Could anyone tell me why am I getting the error?