Instead of replacing the values of the population column with the cumulative sum, crerate a new DataFrame with an additional cumulative population column with the name "cum_population".
Use the column „name“ as the index.
city_frame = pd.DataFrame(cities,
columns=["country",
"population",
"cum_population"],
index=city_frame["name"])
city_frame["cum_population"] = city_frame["population"].cumsum()
city_frame