import datetime as dt import pandas as pd quarter = pd.Timestamp(dt.date(2016, 2, 29)).quarter assert quarter == 1