DataFrame Operations

Learn how to join, merge, and concatenate DataFrames.

Concatenating countries and cities

In GeoPandas we can also perform tabular operations such as join, merge, or concatenate. However, we can have only one active geometry column at a time. In the previous examples, we've used the Natural Earth shapefile, which provides all the countries in the world, as well as the Populated Places dataset with the biggest cities. One way to plot both cities and countries in just one map is to concatenate (line 9) the DataFrame to have countries at the top of the DataFrame and cities at the bottom and share the same geometry column.

Get hands-on with 1200+ tech skills courses.