Creating a GeoDataFrame & examining the geometry
Let's see where service districts are in Nashville. The path to the service district shapefile has been stored in the variable shapefile_path.
Este ejercicio forma parte del curso
Visualizing Geospatial Data in Python
Instrucciones del ejercicio
- Import
geopandaswith its common aliasgpd. - Read in the service district shapefile using
geopandasand look at the first 5 rows using thehead()method. - Print the geometry field in the first row (rowname is '0') to see the data contained in that field. You will pass
service_district.loc[0, 'geometry']to theprint()function to do this.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Import geopandas
import ____ as ____
# Read in the services district shapefile and look at the first few rows.
service_district = gpd.____(shapefile_path)
print(service_district.____())
# Print the contents of the service districts geometry in the first row
print(service_district.loc[0, '____'])