I'm trying to chain and group than map an array using pydash
The idea is to recreate the same output of this lodash function :
let chainedResult = (
_.chain(oResult)
// Group the elements of the result based on `CEMPLOYEE` property
.groupBy("CCALENDAR_WEEK")
// `key` is group's name (CEMPLOYEE), `value` is the array of objects
.map((value, key) => ({
WEEK: key,
Capacity: value
}))
).value();
So far, this is what I achieved
_.chain(empCapacity).group_by(lambda dt:dt["CCALENDAR_WEEK"]).value()
I'm stuck here, on how to make the mapping of the keys and value? How to do the below code in python using pydash?
.map((value, key) => ({
WEEK: key,
Capacity: value
}))
Desired Output :