I have a column in my pandas dataframe called last_pymnt which has dates in the format of 17-Mar, 13-Dec, etc. doing a string replace will be too tedious since there are so many unique dates so I tried to create a dictionary to replace wherever we see the month name with an integer however it does not seem to work. This is what I have.
integers = {'-Jan': 1, '-Feb': 2, '-Mar': 3, '-Apr': 4, '-May': 5, '-Jun': 6, '-Jul': 7, '-Aug': 8,
'-Sep': 9, '-Oct': 10, '-Nov': 11, '-Dec': 12,}
data.replace({'-Jan': integers, '-Feb': integers, '-Mar': integers, '-Apr': integers, '-May':
integers, '-Jun': integers, '-Jul': integers, '-Aug': integers, '-Sep': integers, '-Oct': integers,
'-Nov': integers, '-Dec': integers})
The output was suppose to go throughout the entire dateframe and replace the partial matches with an integer so after running the code the date of 17-Mar should have given the output 173 but I still get the result of 17-Mar
