Session Ready
Exercise

Subtracting & broadcasting

Now that you're comfortable with broadcasting rules, you're going to practice using the .reshape() method together with broadcasting.

The one-dimensional array load_2001 holds the total electricity load for the state of Texas sampled every 15 minutes for the entire year 2001 (35040 samples in total). The one-dimensional array load_recent holds the corresponding data sampled for each of the years 2013 through 2015 (i.e., 105120 samples consisting of the samples from 2013, 2014, & 2015 in sequence). None of these years are leap years, so each year has 365 days. Observe also that there are 96 intervals of duration 15 minutes in each day.

Your job is to compute the differences of the samples in the years 2013 to 2015 each from the corresponding samples of 2001.

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4

Reshape load_recent to three dimensions, with the year on the 1st dimension, the day of the year on the 2nd dimension, and the 15-minute interval of the day on the 3rd dimension. Note that load_recent consists of three dimensions.