I want to have the first non-negativ number in a new column, based on three columns (valueA, valueB, valueC
) if a condition in columnA
is valid. The condition is that columnA!=None
. And an example dataframe df:
columnA valueA valueB valueCNone -40 -41 -42A -5 10 20B -10 -5 10C 1 2 3
would lead to:
columnA valueA valueB valueC valueDNone -40 -41 -42 NoneA -5 10 20 10B -10 -5 10 10C 1 2 3 1