I am having a long dataset and would like to get min/max values in a row:
County Year1 Year2 Year3 Year4
1 Autauga 54660 55253 51253 56253
Output should look like
County Year1 Year2 Year3 Year4 Min Max Max-Min
1 Autauga 54660 55253 51253 56253 51253 56253 5000
My first shot yielded a string as max value (I've read about all the reasons on the forum):
df['Max'] = df.max(axis=1)
1) How can I exclude my first column so the max function runs correctly (I still need the county in my output)?
2) How can I run the max,min functions AND calc the difference of each value in one go?
Cheers, P