Hello I have the following DataFrame df:
A B C D E F
apple 0 red green blue 8
orange 2 red blue white 10
apple 2 red green blue 8
orange 0 red 20 purple 10
I would like to change all cells following a certain cell to empty strings.
I have tried the following code and was wondering if there is a more efficient way to do this
for i in range(len(df['B']):
if df['B'].iloc[i] == 0:
df['C'].iloc[i] = ""
df['D'].iloc[i] = ""
df['E'].iloc[i] = ""
df['F'].iloc[i] = ""
A B C D E F
apple 0
orange 2 red blue white 10
apple 2 red green blue 8
orange 0
Thank you