# Group By

This function takes a list and outputs an object that's grouped by the values in the original list at the specified path.

Returns an object that groups a list of items (for example, objects, strings, numbers) by the specified path's values. Each unique value for the specified path in the input list will have a corresponding key in the object. For each key in the returned object, this function returns a list of items from the input list that have a matching value to the key's specified path.

## Examples

A simple example takes the following as inputs:

Copy
```1
2
3
4
5
6
7
8
9
10
`list =     [        {"a": 1},        {"a": 2},        {"a": 3},        {"a": 3},        {"a": 3}    ] path = a````

This function takes the input list, groups it by the specified path and outputs the following:

Copy
```1
2
3
4
5
6
7
8
9
10
`{    "1": [ {"a": 1} ],    "2": [ {"a": 2} ],    "3":         [             {"a": 3},            {"a": 3},            {"a": 3}        ]}````

A slightly more involved example takes the following inputs:

Copy
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
`list =     [        {            "a": 1            "b": {"c": 2, "d": 3}        },        {        "a": 4,            "b": {"c": 5, "d": 6}        },        {        "a": 7,            "b": {"c": 8, "d": 6}        }    ]path = b.d````

For the preceding input, the function outputs an object that's grouped around the values at the path b.d:

Copy
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
`{    "3":         [             {                "a": 1,                "b":                 {                    "c": 2,                    "d": 3                }            }         ],    "6":         [            {                "a": 4,                "b":                 {                    "c": 5,                    "d": 6                }            },        {            "a": 7,            "b":             {                 "c": 8,                 "d": 6             }        }    ]}}         ],    "3":         [             {"a": 3},            {"a": 3},            {"a": 3}        ]}````

#### Input Fields

• list (List of items (objects, strings, numbers)) - the list of objects that you want to group by the specified path
• path (String) - the value or element to group the list by

#### Output Fields

• output - the output object, where the keys are the unique values at the path from each element in the original list
{"ft_lang_label":"__label__en","ft_lang_prob":0.6706452,"math_prob":0.86065036,"size":1597,"snap":"2023-40-2023-50","text_gpt3_token_len":505,"char_repetition_ratio":0.1569366,"word_repetition_ratio":0.064615384,"special_character_ratio":0.39699435,"punctuation_ratio":0.23913044,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9720166,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-25T22:42:36Z\",\"WARC-Record-ID\":\"<urn:uuid:56e741ff-9741-4f43-ae87-9cc0f0d389be>\",\"Content-Length\":\"37282\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c2659c7b-2904-4b82-8628-ea1f7edb0080>\",\"WARC-Concurrent-To\":\"<urn:uuid:6d839b89-df17-4205-a6a6-e605a98f0490>\",\"WARC-IP-Address\":\"18.67.76.69\",\"WARC-Target-URI\":\"https://help.okta.com/wf/en-us/content/topics/workflows/function-reference/list/list_groupby.htm\",\"WARC-Payload-Digest\":\"sha1:2IHGXKN64W4ZF5DEB7FQUHOZCPSJYZ6C\",\"WARC-Block-Digest\":\"sha1:SW7Z52FU7MUP64YKZF6FRC5N3D6O2ZOP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510100.47_warc_CC-MAIN-20230925215547-20230926005547-00625.warc.gz\"}"}