Skip to content

reindexing non-unique dataframes #2862

Closed
@Aico

Description

@Aico

df3 = DataFrame({'a':[1]})
df4 = DataFrame({'a':[1,2]})
df3
a
0 1
df4
a
0 1
1 2
df4.index = [1,1]
df4.reindex(df3.index)
Traceback (most recent call last):
File "", line 1, in
File "/hostname/home/chik/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pandas/core/frame.py", line 2347, in reindex
'column labels')
File "/hostname/home/chik/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pandas/core/frame.py", line 2423, in _reindex_index
clidx, cridx = None, None
File "/hostname/home/chik/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pandas/core/index.py", line 828, in reindex
return com._ensure_platform_int(indexer)
File "/hostname/home/chik/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pandas/core/index.py", line 749, in get_indexer
def set_value(self, arr, key, value):
Exception: Reindexing only valid with uniquely valued Index objects

Why is this not possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions