1 of 13

Lecture 15: Geopandas

Autumn 2026

1

Sli.do

#cse163

Questions?

Icebreaker

Favorite travel destination(s)?

CSE 163

CSE 163: Geopandas

​

​

2 of 13

Announcements

  • Programming Practice 5 due Sunday, November 8 at 11:59pm on Gradescope
  • Homework 4 due Thursday, November 12 at 11:59pm on Gradescope
  • Project Part 2 (EDA) due Sunday, November 15 at 11:59pm on Gradescope

2

Questions?

CSE 163: Geopandas

​

​

3 of 13

zip

  • zip does not return a list! Returns a generator that you can iterate over one time!

3

x = [1,2,3]

y = [4,5,6]

zip(x, y)

​

​

CSE 163: Geopandas

​

​

4 of 13

Geospatial Data: Map representation of data

4

CSE 163: Geopandas

​

​

5 of 13

Geopandas: pandas with geospatial data

  • Geopandas uses a GeoDataFrame and GeoSeries

5

import geopandas as gpd

​

df = gpd.read_file('data_file.shp')

​

df.plot(column='some_col', legend=True)

plt.savefig('plot.png')

​

CSE 163: Geopandas

​

​

6 of 13

Geopandas: Shapes

  • These live the geometry column of a geospatial dataset
    • Tells geopandas how to represent the geospatial data

6

CSE 163: Geopandas

​

​

7 of 13

Matplotlib

  • Default plots get plotted on a global figure (think like a canvas for painting)
    • Plots would overwrite each other
    • Extra work needed to plot multiple graphs on the same set of axes

7

fig, ax = plt.subplots(1)

<plot1>(ax=ax)

<plot2>(ax=ax)

fig.savefig('plot_together.png')

​

​

​

CSE 163: Geopandas

​

​

8 of 13

Matplotlib

  • Default plots get plotted on a global figure (think like a canvas for painting)
    • Plots would overwrite each other
    • Extra work needed to plot multiple graphs on the same set of axes

8

fig, ax = plt.subplots(1)

<plot1>(ax=ax)

<plot2>(ax=ax)

fig.savefig('plot_together.png')

​

​

​

fig, [ax1, ax2] = plt.subplots(1, 2) # width, height

<plot1>(ax=ax1)

<plot2>(ax=ax2)

fig.savefig('plot_separate.png')

​

​

​

​

​

CSE 163: Geopandas

​

​

9 of 13

Matplotlib

  • Default plots get plotted on a global figure (think like a canvas for painting)
    • Plots would overwrite each other
    • Extra work needed to plot multiple graphs on the same set of axes

9

fig

ax1

ax2

CSE 163: Geopandas

​

​

10 of 13

Matplotlib

  • Default plots get plotted on a global figure (think like a canvas for painting)
    • Plots would overwrite each other
    • Extra work needed to plot multiple graphs on the same set of axes

10

fig

ax1

ax2

CSE 163: Geopandas

​

​

11 of 13

Matplotlib

  • Default plots get plotted on a global figure (think like a canvas for painting)
    • Plots would overwrite each other
    • Extra work needed to plot multiple graphs on the same set of axes

11

fig

ax1

ax2

CSE 163: Geopandas

​

​

12 of 13

Hurricane Florence Example

12

CSE 163: Geopandas

​

​

13 of 13

Hurricane Florence Example

13

CSE 163: Geopandas

​

​