I am trying to figure out how to assign the minimum value between two columns if neither of the columns are not null. So given a dataframe with have the following data populated in a row:
col1 col2 col3
347 933 338
938 523 211
I'm attempting to assign a temp column to the minimum values between col2 and col3, but the following gives me an error:
df.loc[df['col2'].notnull() & df['col3'].notnull(), 'TEMP_rank'] = min(df.loc[['col2'], df['col3']]).min().min()
I also have issues with:
df.loc[df['col2'].notnull() & df['col3'].notnull(), 'TEMP_rank'] = min(df.loc[['col2'], df['col3']]).min(1)
I'd be looking for the following output (testing between columns 2 & 3):
col1 col2 col3 tempCol
347 933 338 338
938 123 211 123