dataframe-js
Version:
Immutable and functional data structure for datascientists and developpers
223 lines (126 loc) • 4.42 kB
Markdown
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### Table of Contents
- [Row][1]
- [toDict][2]
- [toArray][3]
- [size][4]
- [hash][5]
- [has][6]
- [select][7]
- [get][8]
- [set][9]
- [delete][10]
## Row
[src/row.js:11-198][11]
Row data structure used into the dataframe-js.
**Parameters**
- `data` **([Array][12] \| [Object][13] \| [Row][14])** The data of the Row.
- `columns` **[Array][12]** The DataFrame column names.
### toDict
[src/row.js:91-93][15]
Convert Row into dict / hash / object.
**Examples**
```javascript
row.toDict()
```
Returns **[Object][13]** The Row converted into dict.
### toArray
[src/row.js:101-103][16]
Convert Row into Array, loosing column names.
**Examples**
```javascript
row.toArray()
```
Returns **[Array][12]** The Row values converted into Array.
### size
[src/row.js:111-113][17]
Get the Row size.
**Examples**
```javascript
row.size()
```
Returns **Int** The Row length.
### hash
[src/row.js:121-123][18]
Get the Row hash code.
**Examples**
```javascript
row.hash()
```
Returns **Int** The Row hash unique code.
### has
[src/row.js:132-134][19]
Check if row contains a column.
**Parameters**
- `columnName` **[String][20]** The column to check.
**Examples**
```javascript
row.has('column1')
```
Returns **[Boolean][21]** The presence or not of the column.
### select
[src/row.js:143-153][22]
Select columns into the Row.
**Parameters**
- `columnNames` **...[String][20]** The columns to select.
**Examples**
```javascript
row.select('column1', 'column2')
```
Returns **[Row][14]** A new Row containing only the selected columns.
### get
[src/row.js:162-167][23]
Get a Row value by its column.
**Parameters**
- `columnToGet` **[String][20]** The column value to get.
**Examples**
```javascript
row.get('column1')
```
Returns **any** The selected value.
### set
[src/row.js:176-181][24]
Set a Row value by its column, or create a new value if column doesn't exist.
**Parameters**
- `columnToSet` **[String][20]** The column value to set.
- `value`
**Examples**
```javascript
row.set('column1', 6)
```
Returns **[Row][14]** A new Row with the modified / new value.
### delete
[src/row.js:190-197][25]
Delete a Row value by its column.
**Parameters**
- `columnToDel` **[String][20]** The column value to delete.
**Examples**
```javascript
row.delete('column1')
```
Returns **[Row][14]** A new Row without the deleted value.
[1]: #row
[2]: #todict
[3]: #toarray
[4]: #size
[5]: #hash
[6]: #has
[7]: #select
[8]: #get
[9]: #set
[10]: #delete
[11]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L11-L198 "Source code on GitHub"
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[14]: #row
[15]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L91-L93 "Source code on GitHub"
[16]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L101-L103 "Source code on GitHub"
[17]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L111-L113 "Source code on GitHub"
[18]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L121-L123 "Source code on GitHub"
[19]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L132-L134 "Source code on GitHub"
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[22]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L143-L153 "Source code on GitHub"
[23]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L162-L167 "Source code on GitHub"
[24]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L176-L181 "Source code on GitHub"
[25]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/row.js#L190-L197 "Source code on GitHub"