[1]:
import transportation_tutorials as tt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
pd.options.display.max_columns = 100
Prepare a heatmap that visualizes the joint distribution of the number of trips taken by each household and the number of automobiles owned by the household.
To answer the questions, use the following data files:
[2]:
trip = pd.read_csv(tt.data('SERPM8-BASE2015-TRIPS'))
trip.head()
[2]:
hh_id | person_id | person_num | tour_id | stop_id | inbound | tour_purpose | orig_purpose | dest_purpose | orig_mgra | dest_mgra | parking_mgra | stop_period | trip_mode | trip_board_tap | trip_alight_tap | tour_mode | smplRate_geo | autotech | tncmemb | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1690841 | 4502948 | 1 | 0 | -1 | 0 | Work | Home | Work | 7736 | 9290 | -1 | 8 | 6 | 0 | 0 | 6 | 1.0 | 0 | 0 |
1 | 1690841 | 4502948 | 1 | 0 | -1 | 1 | Work | Work | Home | 9290 | 7736 | 0 | 29 | 3 | 0 | 0 | 6 | 1.0 | 0 | 0 |
2 | 1690841 | 4502948 | 1 | 1 | -1 | 0 | Work-Based | Work | Work-Based | 9290 | 7980 | -1 | 13 | 1 | 0 | 0 | 1 | 1.0 | 0 | 0 |
3 | 1690841 | 4502948 | 1 | 1 | -1 | 1 | Work-Based | Work-Based | Work | 7980 | 9290 | -1 | 14 | 1 | 0 | 0 | 1 | 1.0 | 0 | 0 |
4 | 1690841 | 4502948 | 1 | 2 | -1 | 0 | Work-Based | Work | Work-Based | 9290 | 10608 | -1 | 19 | 3 | 0 | 0 | 3 | 1.0 | 0 | 0 |
[3]:
hh = pd.read_csv(tt.data('SERPM8-BASE2015-HOUSEHOLDS'))
hh.head()
[3]:
Unnamed: 0 | hh_id | home_mgra | income | autos | transponder | cdap_pattern | jtf_choice | autotech | tncmemb | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 426629 | 1690841 | 7736 | 512000 | 2 | 1 | MMMM0 | 0 | 0 | 0 |
1 | 426630 | 1690961 | 7736 | 27500 | 1 | 0 | MNMM0 | 0 | 0 | 0 |
2 | 426631 | 1690866 | 7736 | 150000 | 2 | 0 | HMM0 | 0 | 0 | 0 |
3 | 426632 | 1690895 | 7736 | 104000 | 2 | 1 | MMMM0 | 0 | 0 | 0 |
4 | 426633 | 1690933 | 7736 | 95000 | 2 | 1 | MNM0 | 0 | 0 | 0 |