Added weighted median function and tests

You could avoid computing `v = v[mask]` and `wt = w.values[mask]` unless this branch is taken, since indexing needs to allocate a copy.