data = {'Cat': ['A','A','B','B','B','B'],
'L1': ['0','0','0','0','0','0'],
'L2': ['0','0','0','0','0','0'],
'L3': ['0','0','0','0','0','0'],
}
df = pd.DataFrame (data, columns = ['Cat','L1','L2','L3'])
Where 'Cat' is B, I would like to replace values in L1, L2, L3 to nan or ''.
df[['L1','L2','L3']] = np.where(df[['Cat'] == 'B', '')
the above did not work for me as I don't have y. Any suggestion?