And the above comment matters here as you could be assigning ndarrays to the median which (I would guess) will cause problems later.