I have a dataset with the timestamp and some params. It looks like that:
const resp = [
{date: 1576098000, responseBot: 0.47, responseManager: 2.0},
{date: 1576098000, responseBot: 1.50, responseManager: null},
{date: 1576098000, responseBot: 1.05, responseManager: 2.3},
{date: 1576108800, responseBot: 1.00, responseManager: 3.3},
{date: 1576108800, responseBot: 0.60, responseManager: 1.5},
]
...
I need to get a grouped result (by date) and count an average of response (bot and manager). Expected result:
[
{date: 1576098000, responseBotAvg: 1.006, responseManagerAvg: 2.15},
{date: 1576108800, responseBotAvg: 0.8, responseManagerAvg: 2.4}
]
What is the best way to achieve this result in pure javascript?