# import pandas
import pandas as pd
# create dataframe
df = pd.DataFrame({'Name': ['Mukul', 'Rohan', 'Mukul', 'Manoj',
'Kamal', 'Rohan', 'Robin'],
'age': [22, 22, 21, 20, 21, 24, 20]})
# print dataframe
print(df)
# use count() and sort()
df = df.groupby(['Name'])['age'].count().reset_index(
name='Count').sort_values(['Count'], ascending=False)
# print dataframe
print(df)
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;
});
$users = User::select('name')->groupBy('name')->get()->toArray() ;
function groupBy(array, keyFn) {
return array.reduce((accumulator, value) => {
const key = keyFn(value);
if (!accumulator[key]) {
accumulator[key] = [value];
} else {
accumulator[key] = [value];
}
return accumulator;
}, {});
}