DF Groupby Loop
grouped = df.groupby('A')
for name, group in grouped:
...
macarrony00
grouped = df.groupby('A')
for name, group in grouped:
...
data.groupby('amount', as_index=False).agg({"duration": "sum"})
df.groupby('A').agg({'B': ['min', 'max'], 'C': 'sum'})
>>> emp.groupby(['dept', 'gender']).agg({'salary':'mean'}).round(-3)
spUtil.get('pps-list-modal', {title: c.data.editAllocations,
table: 'resource_allocation',
queryString: 'GROUPBYuser^resource_plan=' + c.data.sysId,
view: 'resource_portal_allocations' }).then(function(response) {
var formModal = response;
c.allocationListModal = response;
});
In [21]: g1.add_suffix('_Count').reset_index()
Out[21]:
Name City City_Count Name_Count
0 Alice Seattle 1 1
1 Bob Seattle 2 2
2 Mallory Portland 2 2
3 Mallory Seattle 1 1