Making Simple Graphs with Pandas

Plotting a column of data in a csv file to make a graph is super simple with pandas, the popular Python library.   An example code is shown below: The line df = pd.read_csv(".../earthquakes1970-2014.csv") reads the data and stores it as a pandas dataframe object. The next line df.head() allows you to view several rows of … Continue reading Making Simple Graphs with Pandas


Displaying Rasters Using Rasterio

Single Band Images Rasterio is a popular open source Python library used for viewing and manipulating rasters.  With rasterio, viewing a raster can be done with just a few lines of code, like the example below.  Notice, we are using pyplot's imshow method to display the data. The argument means read the first band … Continue reading Displaying Rasters Using Rasterio

Displaying Shapefiles and Attribute Data Using GeoPandas

Displaying shapefiles in Python using the geopandas and matplotlib libraries is very easy, particularly when using Jupyter notebook. First, import the two libraries into Jupyter notebook, as shown below. import matplotlib.pyplot as plt import geopandas as gpd Next, read the shapefile and convert it into a geopandas dataframe object using the read_file command shown below.  … Continue reading Displaying Shapefiles and Attribute Data Using GeoPandas