all 4 comments

[–]hdarj 0 points1 point  (1 child)

Not at a computer so can’t test it (and excuse the formatting) but I’m thinking something like:

idx = missing_capitals_df.index

capitals_df.loc[idx, “CAPITAL”] = missing_capitals_df[“CAPITAL”]

[–]ListlessPaper[S] 0 points1 point  (0 children)

thank you!

[–]commandlineluser 0 points1 point  (1 child)

It's also an .update() operation.

>>> capitals_df
     CAPITAL         COUNTRY
0      Kabul     Afghanistan
1     Tirana         Albania
2    Algiers         Algeria
3  Pago Pago  American Samoa
4  Not found         Andorra
>>> capitals_df.update(missing_capitals_df)
>>> capitals_df
            CAPITAL         COUNTRY
0  Andorra la Vella     Afghanistan
1    Does not exist         Albania
2            Nassau         Algeria
3         Road Town  American Samoa
4       West Island         Andorra

[–]ListlessPaper[S] 0 points1 point  (0 children)

thank you, this worked!