Try this:
import datetime
d = ['09-2012', '04-2007', '11-2012', '05-2013', '12-2006', '05-2006', '08-2007']
sorted(d, key=lambda x: datetime.datetime.strptime(x, '%m-%Y'))
Related Contents:
- Converting datetime.date to UTC timestamp in Python
- How to change the datetime format in Pandas
- Converting unix timestamp string to readable date
- How to calculate number of days between two given dates
- How to preserve timezone when parsing date/time strings with strptime()?
- How to parse dates with -0400 timezone string in Python?
- What is the standard way to add N seconds to datetime.time in Python?
- Convert datetime object to a String of date only in Python
- Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone
- Weird timezone issue with pytz
- How to convert a UTC datetime to a local datetime using only standard library?
- How do I turn a python datetime into a string, with readable format date?
- How to convert string to datetime format in pandas python?
- Filtering Pandas DataFrames on dates
- Converting string with UTC offset to a datetime object [duplicate]
- Parsing date with timezone from an email?
- Convert string date to timestamp in Python
- Best way to find the months between two dates
- datetime to string with series in pandas
- pandas datetime to unix timestamp seconds
- How can I filter a date of a DateTimeField in Django?
- How to round the minute of a datetime object
- How to truncate the time on a datetime object?
- python pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working
- Datetime Timezone conversion using pytz
- Parsing time string in Python
- Converting between datetime and Pandas Timestamp objects
- Formatting timedelta objects [duplicate]
- How do I create a datetime in Python from milliseconds?
- python – datetime with timezone to epoch
- How do I round datetime column to nearest quarter hour
- NameError: name ‘datetime’ is not defined
- Plotting dates on the x-axis
- Python speed testing – Time Difference – milliseconds
- Convert date from excel in number format to date format python [duplicate]
- Python: datetime tzinfo time zone names documentation
- Subtract a year from a datetime column in pandas
- Get day name from datetime
- ValueError: view limit minimum -35738.3640567 is less than 1 and is an invalid Matplotlib date value
- Convert dataframe index to datetime
- Can’t compare naive and aware datetime.now()
- Python pandas integer YYYYMMDD to datetime
- Python: How to convert datetime format? [duplicate]
- Pandas datetimes with different formats in the same column
- How to get the seconds since epoch from the time + date output of gmtime()?
- How to get UTC time in Python?
- Extract time from datetime and determine if time (not date) falls within range?
- datetime: Round/trim number of digits in microseconds
- Python generating a list of dates between two dates
- Get weekday/day-of-week for Datetime column of DataFrame