Session Ready
Exercise

Explore the Paris districts (II)

In the previous exercise, we used the customized plot() method of the GeoDataFrame, which produces a simple visualization of the geometries in the dataset. The GeoDataFrame and GeoSeries objects can be seen as "spatial-aware" DataFrame and Series objects, and compared to their pandas counterparts, they expose additional spatial-specific methods and attributes.

The .geometry attribute of a GeoDataFrame always returns the column with the geometry objects as a GeoSeries, whichever the actual name of the column (in the default case it will also be called 'geometry').

Another example of extra spatial functionality is the area attribute, giving the area of the polygons.

GeoPandas has been imported as geopandas and the districts dataset is available as the districts variable.

Instructions
100 XP
  • Check what kind of object districts is with the type() function.
  • Access the geometry attribute of the districts GeoDataFrame and print the type of this object.
  • Show the first 5 rows of the geometry.
  • Inspect the area of the districts's geometries.