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

**URL:** <https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113>\
**Category:** Help\
**Created:** [January 22, 2022, 5:32pm UTC](https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113 "2022-01-22T17:32:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heli](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/heli/32/3847_2.png) [@Heli](https://talk.observablehq.com/u/Heli)\
**Post date:** [January 22, 2022, 5:32pm UTC](https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113/1 "2022-01-22T17:32:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [January 22, 2022, 6:35pm UTC](https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113/2 "2022-01-22T18:35:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Heli](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/heli/32/3847_2.png) [@Heli](https://talk.observablehq.com/u/Heli)\
**Post date:** [January 22, 2022, 9:53pm UTC](https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113/3 "2022-01-22T21:53:45Z")

</div>

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’?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/3/3c005c13523dc3920f48d0517c07f9f1a3918685.png)

---

<div class="post-metadata">

**Author:** ![mcmcclur](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mcmcclur/32/2364_2.png) [@mcmcclur](https://talk.observablehq.com/u/mcmcclur)\
**Post date:** [January 22, 2022, 10:05pm UTC](https://talk.observablehq.com/t/how-to-group-the-data-based-on-the-label-in-ob-language/6113/4 "2022-01-22T22:05:44Z")

</div>

`d3.group` returns a standard Javascript `map` object, which is very [well documented on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).
