Working with geospatial data
For our last case study, let us explore the analysis of geospatial data using an extension to the Pandas library, GeoPandas. You will need to have GeoPandas installed in your IPython environment to follow this example. If it is not already installed, you can add it using easy_install
or pip.
Loading geospatial data
In addition to our other dependencies, we will import the GeoPandas
library using the command:
>>> import GeoPandas as geo.
We load dataset for this example, the coordinates of countries in Africa ("Africa." Maplibrary.org. Web. 02 May 2016. http://www.mapmakerdata.co.uk.s3-website-eu-west-1.amazonaws.com/library/stacks/Africa/) which are contained in a shape (.shp
) file as before into a GeoDataFrame, an extension of the Pandas DataFrame, using:
>>> africa_map = geo.GeoDataFrame.from_file('Africa_SHP/Africa.shp')
Examining the first few lines using head()
:
We can see that the data consists of identifier columns, along...