%a Sun, Mon, …, Sat
%A Sunday, Monday, …, Saturday
%w Weekday as number, where 0 is Sunday
%d Day of the month 01, 02, …, 31
%b Jan, Feb, …, Dec
%B January, February, …, December
%m Month number as a zero-padded 01, 02, …, 12
%y 2 digit year zero-padded 00, 01, …, 99
%Y 4 digit Year 1970, 1988, 2001, 2013
%H Hour (24-hour clock) zero-padded 00, 01, …, 23
%I Hour (12-hour clock) zero-padded 01, 02, …, 12
%p AM or PM.
%M Minute zero-padded 00, 01, …, 59
%S Second zero-padded 00, 01, …, 59
%f Microsecond zero-padded 000000, 000001, …, 999999
%z UTC offset in the form +HHMM or -HHMM +0000, -0400, +1030
%Z Time zone name UTC, EST, CST
%j Day of the year zero-padded 001, 002, …, 366
%U Week number of the year zero padded, Days before the first Sunday are week 0
%W Week number of the year (Monday as first day)
%c Locale’s date and time representation. Tue Aug 16 21:30:00 1988
%x Locale’s date representation. 08/16/1988 (en_US)
%X Locale’s time representation. 21:30:00
%% literal '%' character.
# Import the calendar module
import calendar
# Extract month as a number from the date column
df['Month']=pd.DatetimeIndex(df['Date']).month
# Using list comprehension extract month abbreviations for each month number
df['Month_abbr']=[calendar.month_abbr[int(i)] if pd.notna(i) else i for i in df['Month']]