Closed
Description
import pandas as pd
ind = ['A', 'A', 'B', 'C']i
df = pd.DataFrame({'test':range(len(ind))}, index=ind)
rows = ['C', 'B']
res = df.ix[rows]
assert rows == list(res.index) # fails
The problem is that the resulting DataFrame keeps the ordering of the df.index
and not the rows
key. You'll notice that the rows
key doesn't reference a duplicate value.