Closed
Description
When I run this code on 0.17.0 on Python 3.5.0
import pandas as pd
d = pd.DataFrame(data=[[2, 1]])
print(d.index)
print((d.
groupby(level=0).
apply(lambda d:
d.sort_values(0)
)
).index)
I get
Int64Index([0], dtype='int64')
MultiIndex(levels=[[0], [0]],
labels=[[0], [0]])
The index gets duplicated (and turned into a multiindex) as a result of the sort
within the groupby
.
Appears to be a bug to me.