If I want to set the same value for all matches I can do:
df.loc[df.A.isin(some_list), 'C'] = value
The replace
and update
methods change existing values in some column, but don't seem to allow changing values in column C for the matching entries in column A as explained below.
Remap values in pandas column with a dict
But what if I have a dictionary (or two aligned lists - one with A and one with C values)?
I can loop over the keys in dict and change the values one-by-one, but that is awfully slow.