How to group the data based on the label in Ob language

Dear all, I want to group the data based on different ‘model’ number, how could I write in Ob?
https://observablehq.com/d/f7f152b0dabfc337
Thank you very much in advance.

d3.group(data, d => d.model)

1 Like

Thank you very much, it works! Let’s say ‘map = d3.group(data, d => d.model)’, then how could I get one of the objects in map, like ‘model=1’?

d3.group returns a standard Javascript map object, which is very well documented on MDN.

1 Like