Exercise

Bike traffic throughout the week

In 2012, the City of Seattle installed meters to count bicycles crossing the Fremont Bridge, a major thoroughfare for cyclists commuting to downtown Seattle from the northern neighborhoods.

A 2D NumPy array called bike_traffic is loaded, which contains the average number of cyclists that were counted crossing the Fremont Bridge during each hour of the day for each day of the week from Oct 2012 to mid-June 2018.

  • Each column is a day of the week, starting on Monday.
  • Each row is an hour of the day, beginning with the 12am-1am hour.

Don't forget that indexing in Python is a bit different from MATLAB:

  • Python indexing starts at 0, not 1
  • In Python, you can use negative indices: -1 is equivalent to MATLAB's end

Instructions 1/4

undefined XP
  • 1

    To confirm which axis is hours and which is days, print the shape of the bike_traffic array.

  • 2

    Print traffic on Friday (the fifth column) during the 4 pm hour.

  • 3

    Print total traffic on a typical Monday.

  • 4

    Print the average hourly traffic on weekends between 10 am and 1 pm.