5

How do one get a SQL-style grouped output when grouping following data:

   item   frequency
    A      5
    A      9
    B      2
    B      4
    C      6

df.groupby(by = ["item"]).sum()

results in this:

  item   frequency
    A      14
    B      6
    C      6

In pandas it is achieved by setting as_index=False. But dask doesn't support this argument in groupby. It currently omits item column and returns the series with frequency column.

Omley
  • 426
  • 6
  • 17

1 Answers1

5

Perhaps call .reset_index afterwards?

MRocklin
  • 55,641
  • 23
  • 163
  • 235