Analyse gets the iterable as argument, which gets converted to a list and we build an array of the indexes of each datetime. This indexes array is then used to select items in the data array, and the mean of this is returned. The final plot will look like :

Note that we plot the bars with a facecolor proportional to the data value (using import matplotlib.cm as cm):