I have viewed many of the questions that come up with this error. I am running pandas '0.10.1'
df = DataFrame({'A' : np.random.randn(5),
'B' : np.random.randn(5),'C' : np.random.randn(5),
'D':['a','b','c','d','e'] })
#gives error
df.take([2,0,1,2,3], axis=1).drop(['C'],axis=1)
#works fine
df.take([2,0,1,2,1], axis=1).drop(['C'],axis=1)
Only thing I can see is that in the former case I have the non-numeric column, which seems to be affecting the index somehow but the below command returns empty:
df.take([2,0,1,2,3], axis=1).index.get_duplicates()
Reindexing error makes no sense does not seem to apply as my old index is unique.
My index appears unique as far as I can tell using this command df.take([2,0,1,2,3], axis=1).index.get_duplicates() from this Q&A: problems with reindexing dataframes: Reindexing only valid with uniquely valued Index objects
"Reindexing only valid with uniquely valued Index objects" does not seem to apply
I think my pandas version# is ok so this should bug should not be the problem pandas Reindexing only valid with uniquely valued Index objects