Exercise

Heatmap of Travel Times By Commute Mode

In this exercise, you will create a heatmap of national data comparing commute times (in minutes) and travel modes. You begin with data_row, a list of values from the single data row of a JSON API response object. Lists of travel modes(5) and commute times (9) have been created, and are printed to the console. You must reshape the single data row into a list of lists, construct a DataFrame suitable to pass to sns.heatmap, and create the heatmap.

The data row contains data on the 5 travel modes in groups of 9 commute times. An iteration is a complete set of commute times.

pandas and seaborn are loaded using the usual aliases.

Instructions

100 XP
  • Set iter_len to the length of the times list
  • In the list comprehension, construct a range with a start of 0, stop of the length of the data_row, and step of iter_len
  • Construct a heatmap with the commuting DataFrame as the first parameter; annotate the heatmap with the commute count in thousands (use integer division to divide by 1000)