BUG: sparse/compressed: work around bug in np.unique in earlier numpy versions

Work around the bug fixed in numpy/numpy@dbf23516, for Numpy versions before that.