I have DataFrames
between 100k and 2m in size. the one I am dealing with for this question is this large, but note that I will have to do the same for the other frames:
>>> len(data)
357451
now this file was created by compiling many files, so the index for it is really odd. So all I wanted to do was reindex it with range(len(data))
, but I get this error:
>>> data.reindex(index=range(len(data)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/frame.py", line 2542, in reindex
fill_value, limit)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/frame.py", line 2618, in _reindex_index
limit=limit)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/index.py", line 893, in reindex
limit=limit)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/index.py", line 812, in get_indexer
raise Exception('Reindexing only valid with uniquely valued Index '
Exception: Reindexing only valid with uniquely valued Index objects
This actually makes no sense. Since I am reindexing with an array containing numbers 0 through 357450, all Index objects are unique! Why is it returning this error?
Extra info: I am using python2.7 and pandas 11.0