CSE 163
Dissolve and Join�
Suh Young Choi�
Announcements
Checkpoint 4 due on Monday
THA 5: Mapping due on Thursday
New Resubmission cycle!
2
This Time
Last Time
3
Geopandas
4
import geopandas as gpd
df = gpd.read_file('data_file.shp')
df.plot(column='some_col', legend=True)
plt.savefig('plot.png')
Matplotlib
5
fig, ax = plt.subplots(1)
<plot1>(ax=ax)
<plot2>(ax=ax)
fig.savefig('plot.png')
Dissolve
6
Join
7
tas.merge(grading, left_on='ta_id',
right_on='grader_id')
ta_name | ta_id |
Ryan | 1 |
James | 2 |
Nicole | 3 |
grader_id | student_name |
2 | Flora |
3 | Paul |
1 | Wen |
3 | Andrew |
ta_name | ta_id | grader_id | student_name |
Ryan | 1 | 1 | Wen |
James | 2 | 2 | Flora |
Nicole | 3 | 3 | Paul |
Nicole | 3 | 3 | Andrew |
Types of Join
There are interesting questions of what happens if there are rows that don’t “line up”. Different type of joins differ in how to handle this case.
Types of Joins
left.merge(right, left_on=’lcol’, right_on=’rcol’,
how=’type’)
8
Hurricane Florence
9
Before Next Time
Next Time
10