assign a value to a column based on another column pandas code example Example: set value based on column df.loc[df['c1'] == 'Value', 'c2'] = 10