<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

# GroupedDataFrame

[src/groupedDataframe.js:10-118](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L10-L118 "Source code on GitHub")

Grouped DataFrame structure grouping DataFrame rows by column value.

## constructor

[src/groupedDataframe.js:21-25](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L21-L25 "Source code on GitHub")

Create a GroupedDataFrame. Used in DataFrame.groupBy('columnName').

**Parameters**

-   `df` **DataFrame** The DataFrame to group by.
-   `columnName` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The column used for the group by.
-   `columnNames` **...any** 

**Examples**

```javascript
df.groupBy('column1');
//or
new GroupedDataFrame(df, 'column1');
```

## toCollection

[src/groupedDataframe.js:63-65](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L63-L65 "Source code on GitHub")

Convert GroupedDataFrame into collection (Array) of dictionnaries (Object).

**Examples**

```javascript
groupedDF.toCollection();
```

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** An Array containing group: {groupKey, group}.

## show

[src/groupedDataframe.js:74-82](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L74-L82 "Source code on GitHub")

Display the GroupedDataFrame as String Table.

**Parameters**

-   `quiet` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Quiet mode. If true, it doesn't trigger console.log(). (optional, default `false`)

**Examples**

```javascript
groupedDf.show()
```

Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The GroupedDataFrame as String Table.

## listGroups

[src/groupedDataframe.js:90-92](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L90-L92 "Source code on GitHub")

List GroupedDataFrame groups.

**Examples**

```javascript
gdf.listGroups()
```

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** An Array containing GroupedDataFrame group names.

## listHashs

[src/groupedDataframe.js:100-102](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L100-L102 "Source code on GitHub")

List GroupedDataFrame groups as a hashCode.

**Examples**

```javascript
gdf.listHashCodes()
```

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** An Array containing GroupedDataFrame hash codes.

## aggregate

[src/groupedDataframe.js:112-117](https://github.com/Gmousse/dataframe-js/blob/c52165fc0dec43d8269c4a3f13368b409cc7b360/src/groupedDataframe.js#L112-L117 "Source code on GitHub")

Create an aggregation from a function.

**Parameters**

-   `func` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** The aggregation function.

**Examples**

```javascript
groupedDF.aggregate(group => group.stat.sum('column1'));
```

Returns **DataFrame** A new DataFrame with a column 'aggregation' containing the result.
