I currently have a string in the format of month year. The month is 3 characters long and the year is 4. Below are some examples of some of the dates that I have.
apr2021
jun2021
mar2020
dec2020
I have a date in a pandas dataframe that is in the form of yyyy-mm-dd hh:mm:ss. I want to compare this string to the date in pandas and determine if it is less than or equal to it? Is there a way to turn this month-year string into an actual date format?
I'm going to strip the date to yyyy-mm-dd and then try to get the month-year string in the same format and then do a direct comparison. I'm not quite sure if there is a more efficient way to do this though?
Example pseudo-code below:
temp_date = apr2021 -> 01-04-2021
pandas_date = 29-03-2021
if temp_date < pandas_date:
do x
else:
do y