如果直接打印grouby的结果默认是一个对象格式:
国外找到如下资料1:
In Jupyter Notebook, if you do the following, it prints a nice grouped version of the object. The apply
method helps in creation of a multiindex dataframe.
Output:
If you want the by
column(s) to not appear in the output, just drop the column(s), like so.
Output:
Here, I am not sure as to why .iloc[:]
does not work instead of [:]
at the end. So, if there are some issues in future due to updates (or at present), .iloc[:len(a)]
also works.