I have a dataframe as follows:
df_ = pl.DataFrame({'r_num':['Yes','','Yes'],'pin':['Yes','',''],'fin':['','','']})
Here I would like to find an observation which has r_num is YES, pin is Yes and fin is EMPTY. on meeting this condition r_num and pin should be filled in as EMPTY.
df_.with_columns(pl.when((pl.col('r_num')=='Yes') & (pl.col('pin')=='Yes') & (pl.col('fin') !='Yes')
).then(pl.col('r_num')=='').otherwise(pl.col('r_num')))
Here why r_num is getting filled up with false?
Here is a syantax that i'm following. how to specify multiple columns in then clause.
expected output will be:
Here is a syntax to implement the same in pandas:
df_.loc[(df_['r_num']=='Yes') & (df_['pin']=='Yes') & (df_['fin']!='Yes'),['r_num','pin']]=''
``