When the returned dataframe(or series) have the same length of the original dataframe. The index for grouped keys are missing. For example: a = pd.DataFrame({'l':['a','a','b','b','c'],'x':[1,2,3,4,5]}) a.groupby('l')['x'].apply(lambda r: r)
output: 0 1 1 2 2 3 3 4 4 5
Notice the key 'l' is missing in the output.
This cause some problem if one is not sure whether the returned dataframe or sereires will have the same length.
Best regards
A small, complete example of the issue
# Your code here
Expected Output
Output of pd.show_versions()
Comment From: jreback
this ian a duplicate of https://github.com/pandas-dev/pandas/issues/14370 (and others as I have seen this multiple times)
I don't think this is actually possible to fix (though maybe someone wants to dive in) so next best thing is a doc note
if u want to put up a note (or try to fix), we can reopen