In Python 2.7.11 & Pandas 0.18.1:
If we have the following csv file:
YEAR,MONTH,ID 2011,JAN,1 2011,FEB,1 2011,MAR,1
Is there an
Following Max's last point; create the same thing but rely on your local dataframe's way of encoding months:
# create mapping d = dict((v,k) for k,v in zip(range(1, 13), df.Month.unique())) # create column df['month_index'] = df['Month'].map(d)