I have a Column 'Date' which has values in the form YYYYMM, The Column date is of type float.
I wish to convert it in to date type as YYYY-MM.
When I try the below, it gives the error float is not sliceable.
df['Date'] = pd.to_datetime(df['Date'], format='%Y%m').dt.strftime('%Y%m')
Input Data
Date(Float)
201101.0
201812.0
Output Required
Date(Date Type)
2011-01
2018-12