Closed
Description
- Add
__inverse__
to Index. - Change duplicated to return np.array (PR API: Index.duplicated should return np.array #9112)
Related to #7979
Because Index
is no more the subclass of np.array
, Index.duplicated
returns Index
with dtype=object
. And Index
don't accepts logical not.
idx = pd.Index([1, 2, 1, 3])
idx.duplicated()
# Index([False, False, True, False], dtype='object')
~idx.duplicated()
# TypeError: bad operand type for unary ~: 'Index'
As a result, it is impossible to drop data which have duplicated index using expression like df[~df.index.duplicated()]
. This expression was worked at the timing of #7979.
Does Index.duplicated
should return np.array
with dtype=bool
? Or Index
should accept logical not?