BUG: preserve ndarray subclasses in median

closes gh-3846