Can we check the data in a pandas.core.groupby.SeriesGroupBy
object?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
First option: iterate over all groups.
for name, group in df.groupby(column):
print(name)
print(group)
print('\n')
Second option: if you want to see the group for a specific value, use the get_group
method.
df.groupby(column).get_group(name)
回答2:
Sure, just use
df.groupby(column).head()
It shows you the first n rows (default: 5).
回答3:
Just adding list() should help but the structure isn't super useful in its raw form. It returns a list of tuples with index.