1. Learn
  2. /
  3. Courses
  4. /
  5. Visualizing Geospatial Data in Python

Exercise

Construct a GeoDataFrame from a DataFrame

In this exercise, you will construct a geopandas GeoDataFrame from the Nashville Public Art DataFrame. You will need to import the Point constructor from the shapely.geometry module to create a geometry column in art before you can create a GeoDataFrame from art. This will get you ready to spatially join the art data and the neighborhoods data in order to discover which neighborhood has the most art.

The Nashville Public Art data has been loaded for you as art.

Instructions

100 XP
  • Import Point from the shapely.geometry module.
  • Print the head() of the art data.
  • Complete the code for a lambda expression that will create a Point geometry column from the lng and lat columns in art. Remember that longitude comes first!
  • Build a GeoDataFrame using art and call it art_geo. Set crs equal to neighborhoods.crs and set geometry equal to the column you just created. Print the type() of art_geo to verify it is a GeoDataFrame.