Closed
Description
This might not necessarily a new thing since 0.14, but I find the output of group.head() not appropriate for a grouping:
df = pd.DataFrame(np.random.randn(6,2))
df['A'] = [1,2,2,1,1,2]
df
0 1 A
0 -0.047101 0.828542 1
1 1.617815 0.362700 2
2 1.366453 -1.116897 2
3 0.086743 -0.611371 1
4 1.918440 -1.230909 1
5 -1.003828 -0.592541 2
g = df.groupby('A')
g.head(2)
0 1 A
0 -0.047101 0.828542 1
1 1.617815 0.362700 2
2 1.366453 -1.116897 2
3 0.086743 -0.611371 1
My expectation of the previous output would be:
0 1 A
0 -0.047101 0.828542 1
3 0.086743 -0.611371 1
1 1.617815 0.362700 2
2 1.366453 -1.116897 2
because, after all, this is the result of a grouping, so things should be displayed grouped, shouldn't they?