Python Pandas: Is Order Preserved When Using groupby() and agg()?

前端 未结 5 2076
清歌不尽
清歌不尽 2020-12-14 00:21

I\'ve frequented used pandas\' agg() function to run summary statistics on every column of a data.frame. For example, here\'s how you would produce the mean an

5条回答
  •  渐次进展
    2020-12-14 00:49

    Panda's 0.19.1 doc says "groupby preserves the order of rows within each group", so this is guaranteed behavior.

    http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.groupby.html

提交回复
热议问题