][- ]]figure - compatible array shapes for broadcasting over array thusif we had three-dimensional array and wanted to demean axis saywe would only need to writein [ ]arr randn( in [ ]depth_means arr mean( in [ ]depth_means out[ ]array([ - ] - ] - ]]in [ ]demeaned arr depth_means[::np newaxisin [ ]demeaned mean( out[ ]array([ - ] - - ][- - ]]if you're completely confused by thisdon' worry with practice you will get the hang of it advanced numpy www it-ebooks info