Update values in dataframe

The sql query to update some values is -
UPDATE table_name
SET column1=value1,column2=value2
WHERE condition

What will be the equivalent code in pandas dataframe.

Something like this (I haven’t tried this myself):

df.loc[condition, [column1, column2]] = value1, value2

1 Like