I have 4 columns in the dataframe and would like to change all the values in column 2 based on the below condition:
if pd.isnull(df['COL2']) or df['COL2'] == "SOME_NAME":
if pd.isnull(df['COL3']) == False:
df['COL2'] = df['COL3']
else:
df['COL2'] = "DEFAULT"
so basically if col2 is empty or has some specific name replace it with col3 if col3 not empty else replace with default
I iterated over the df but the matching is not replacing all the values. I have some rows with col2 value still set to "SOME_NAME". Is there a simple way of doing this?