1 of 13

CSE 163

Geopandas

Arpan Kapoor�Summer 2026��💭Icebreaker (discuss with neighbors): ‘

What’s the most difficult sport to play?

Add to our Slido!

slido.com

#2348882

2 of 13

Announcements

  • Homework 4: Networks due Friday July 31st at 11:59pm
  • Project Part 2 (EDA) due Sunday August 2nd at 11:59pm
    • Group Projects: only one person needs to submit but add your teammates to your submission using these instructions

slido.com

#2348882

3 of 13

zip

  • Helpful built-in function to help combine lists
  • zip does not return a list! zip returns a generator that you can iterate over once!

x = [1,2,3]

y = [4,5,6]

zip(x, y)

slido.com

#2348882

4 of 13

Geospatial Data!: Map representation of data

slido.com

#2348882

5 of 13

Shapes

  • These live in the geometry column

slido.com

#2348882

6 of 13

Geopandas - pandas with geo data

  • GeoDataFrame and GeoSeries

import geopandas as gpd

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

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

plt.savefig('plot.png')

slido.com

#2348882

7 of 13

Matplotlib

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

fig, ax = plt.subplots(1)

<plot1>(ax=ax)

<plot2>(ax=ax)

fig.savefig('plot_together.png')

slido.com

#2348882

8 of 13

Matplotlib

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

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')

slido.com

#2348882

9 of 13

Matplotlib

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

fig

ax1

ax2

slido.com

#2348882

10 of 13

Matplotlib

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

fig

ax1

ax2

slido.com

#2348882

11 of 13

Matplotlib

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

fig

ax1

ax2

slido.com

#2348882

12 of 13

Hurricane Florence

slido.com

#2348882

13 of 13

Hurricane Florence

slido.com

#2348882