I have the following data.
And I am hoping to add values C and D from 2000, with A from 2001, and create a new column in the data frame, which should look like something like this
where the last column in 2003 is blank because it is incomplete (no data in A, 2004)
I've tried:
sum_cda = df.columns[2:4]....
df['sum'] = df[sum_cda].sum(axis=1)
I am a newbie in both python and pandas, and I've tried searching the internet for answers to no avail.
Thank you!
FOLLOW UP QUESTION:
what if I want to get the minimum or count or max values between CDA? df['sum'] = df[['C', 'D']].min(axis=1)..

