I have a data frame with date in the format "Mar-97" and I want to convert it into "03-1997". The format of data is
Month SilverPrice GoldPrice
0 Mar-97 186.48 12619.24
1 Apr-97 170.65 12338.59
2 May-97 170.44 12314.94
3 Jun-97 169.96 12202.78
4 Jul-97 155.80 11582.07
I have written this code but it is converting it into "1997-03-01"
from datetime import datetime
df["Month"]=list(map(lambda x:datetime.strptime(x,'%b-%y'),df["Month"]))
and the output is something like this
Month SilverPrice GoldPrice
0 1997-03-01 186.48 12619.24
1 1997-04-01 170.65 12338.59
2 1997-05-01 170.44 12314.94
3 1997-06-01 169.96 12202.78
4 1997-07-01 155.80 11582.07
I can do it by stripping the day value but is there any direct way to convert it into the "MM-YYYY" format .