I'm trying to change the data-type of a column in a pandas dataframe to datetype from string. My required format is Mon-Year (eg: Jan-2018). I have tried:
dataframe['date_col'] = pd.to_datetime(dataframe['date_col'], format='%b-%Y')
I got the following warning, and the output that I get is in the format year-month-day something like (2018-01-01).
main:1: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
How to get the output format I want, which is Jan-2018.