【发布时间】:2019-06-12 06:38:57
【问题描述】:
我在 jupyter notebook 中有以下代码:
import h5py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_hdf('accounting-2018-10-deid.h5', 'table')
df.columns
Out[4]:
Index(['group', 'owner', 'job_number', 'submission_time', 'start_time',
'end_time', 'failed', 'exit_status', 'granted_pe', 'slots',
'task_number', 'maxvmem', 'h_data', 'h_rt', 'highp', 'exclusive',
'h_vmem', 'gpu', 'pe', 'slot', 'wait_time', 'wtime', 'campus'],
dtype='object')
各列的含义:
owner: the owner of a job
group: the group a owner belongs to; a group can have one or more owners
任务是: 对于每个组,列出用户数量,并列出所有这些用户(即具有相同“组”字段的用户)。 例如:组 1(4 个用户):user2、user32、user41、user56?
我尝试使用 groupby() 但没有得到正确答案。 请帮我。
【问题讨论】:
标签: python jupyter-notebook pandas-groupby