[BUG] Grouped-by column loses name when empty list of aggregations is specified. (original) (raw)

In [53]: a = pd.DataFrame({'a': [1, 1, 2], 'b': [1, 2, 3], 'c': [1, 2, 4]})

In [54]: a.groupby('a').agg({'c': ['min']}) # name preserved in index
Out[54]:
    c
  min
a
1   1
2   4

In [55]: a.groupby('a').agg({'b': [], 'c': ['min']}) # name lost in index
Out[55]:
    c
  min
1   1
2   4

In the above snippet, the name of the grouped by column ('a') is preserved in the former case, and lost in the latter case.