Having 2 columns where i have to update the third column based on the conditional statement between 2 columns. How i can use the same , i have tried but the case is not working.
We need to check for the condition if Col1 is having value but col2 is blank.
Input Data:
col1 col2 col3
azb225 AS277
Dzb555
NZb777 NZb777
ZQS285
NBC605 NZ3385
Output Expected:
col1 col2 col3
azb225 AS277 Available
Dzb555 Not Available
NZb777 NZb777 Available
ZQS285 Not Available
Available
NBC605 NZ3385 Available
code i have been using :
df['col3']=df.apply(lambda x:'Not Available' if (x['col1'].notna().all(axis=1)) and (x['col2'].isna().all(axis=1)) else 'Available',1)
But the above code is not working in this case.
Please Suggest.