I have the pandas data frame like this
YEAR_OPENED 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
1999 1 0 0 0 1 0 0 0 1 0
2000 1 1 2 0 3 0 0 0 0 0
2001 0 0 0 4 0 0 0 0 0 0
I want to add all my values in a given column like this:
YEAR_OPENED CLOSED_IN_5_YEARS
1999 2
2000 7
2001 4
So basically I want to check if my column names fall in the five-year range of the corresponding values in the column 'YEAR_OPENED' and create the new column with a sum of all the values. How should I proceed?