I need to update a pandas data frame column using column values in another data frame. I am new to Python but have some background in SQL.
Specifically, I have 'city' and 'state columns in df1 with 62K rows, and 'city' and 'state' columns in df2 (a data frame with population data from the US Census). Do I have to loop through df1 to update the empty 'population' column for each row, or can it be done with a merge, update, or replace in just a few lines of code?
In SQL I would simply write an update query to update the empty table column with the values in the column in the other table after joining the two tables with a left join. Is there something similar to that in Python? Thank you very much.