Lecture 11
Joins
DATA 8
Fall 2017
Slides created by John DeNero (denero@berkeley.edu) and Ani Adhikari (adhikari@berkeley.edu)
Announcements
Attendance
Joins
Joining Two Tables
Drink | Cafe | Price |
Milk Tea | Tea One | 4 |
Espresso | Nefeli | 2 |
Latte | Nefeli | 3 |
Espresso | Abe's | 2 |
Coupon | Location |
25% | Tea One |
50% | Nefeli |
5% | Tea One |
drinks
discounts
Cafe | Drink | Price | Coupon |
Nefeli | Espresso | 2 | 50% |
Nefeli | Latte | 3 | 50% |
Tea One | Milk Tea | 4 | 25% |
Tea One | Milk Tea | 4 | 5% |
drinks.join('Cafe', discounts, 'Location')
Keep all rows in the table that have a match ...
… for the value in this column ...
… somewhere in this other table's ...
… column that contains matching values.
The joined column is sorted automatically
(Demo)
Bikes
Maps
Maps
A table containing columns of latitude and longitude values can be used to generate a map of markers
Applies to all features:
color='blue'
size=200
_______.map_table(table, ...)
Either Marker or Circle
Column 0: latitudes
Column 1: longitudes
Column 2: labels
Column 3: colors
Column 4: sizes