dataframe-js
Version:
Immutable and functional data structure for datascientists and developpers
268 lines (156 loc) • 5.13 kB
Markdown
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### Table of Contents
- [Row][1]
- [Parameters][2]
- [toDict][3]
- [Examples][4]
- [toArray][5]
- [Examples][6]
- [size][7]
- [Examples][8]
- [hash][9]
- [Examples][10]
- [has][11]
- [Parameters][12]
- [Examples][13]
- [select][14]
- [Parameters][15]
- [Examples][16]
- [get][17]
- [Parameters][18]
- [Examples][19]
- [set][20]
- [Parameters][21]
- [Examples][22]
- [delete][23]
- [Parameters][24]
- [Examples][25]
## Row
[src/row.js:11-185][26]
Row data structure used into the dataframe-js.
### Parameters
- `data` **([Array][27] \| [Object][28] \| [Row][29])** The data of the Row.
- `columns` **[Array][27]** The DataFrame column names.
### toDict
[src/row.js:78-80][30]
Convert Row into dict / hash / object.
#### Examples
```javascript
row.toDict()
```
Returns **[Object][28]** The Row converted into dict.
### toArray
[src/row.js:88-90][31]
Convert Row into Array, loosing column names.
#### Examples
```javascript
row.toArray()
```
Returns **[Array][27]** The Row values converted into Array.
### size
[src/row.js:98-100][32]
Get the Row size.
#### Examples
```javascript
row.size()
```
Returns **Int** The Row length.
### hash
[src/row.js:108-110][33]
Get the Row hash code.
#### Examples
```javascript
row.hash()
```
Returns **Int** The Row hash unique code.
### has
[src/row.js:119-121][34]
Check if row contains a column.
#### Parameters
- `columnName` **[String][35]** The column to check.
#### Examples
```javascript
row.has('column1')
```
Returns **[Boolean][36]** The presence or not of the column.
### select
[src/row.js:130-140][37]
Select columns into the Row.
#### Parameters
- `columnNames` **...[String][35]** The columns to select.
#### Examples
```javascript
row.select('column1', 'column2')
```
Returns **[Row][29]** A new Row containing only the selected columns.
### get
[src/row.js:149-154][38]
Get a Row value by its column.
#### Parameters
- `columnToGet` **[String][35]** The column value to get.
#### Examples
```javascript
row.get('column1')
```
Returns **any** The selected value.
### set
[src/row.js:163-168][39]
Set a Row value by its column, or create a new value if column doesn't exist.
#### Parameters
- `columnToSet` **[String][35]** The column value to set.
- `value`
#### Examples
```javascript
row.set('column1', 6)
```
Returns **[Row][29]** A new Row with the modified / new value.
### delete
[src/row.js:177-184][40]
Delete a Row value by its column.
#### Parameters
- `columnToDel` **[String][35]** The column value to delete.
#### Examples
```javascript
row.delete('column1')
```
Returns **[Row][29]** A new Row without the deleted value.
[1]: #row
[2]: #parameters
[3]: #todict
[4]: #examples
[5]: #toarray
[6]: #examples-1
[7]: #size
[8]: #examples-2
[9]: #hash
[10]: #examples-3
[11]: #has
[12]: #parameters-1
[13]: #examples-4
[14]: #select
[15]: #parameters-2
[16]: #examples-5
[17]: #get
[18]: #parameters-3
[19]: #examples-6
[20]: #set
[21]: #parameters-4
[22]: #examples-7
[23]: #delete
[24]: #parameters-5
[25]: #examples-8
[26]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L11-L185 "Source code on GitHub"
[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[29]: #row
[30]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L78-L80 "Source code on GitHub"
[31]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L88-L90 "Source code on GitHub"
[32]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L98-L100 "Source code on GitHub"
[33]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L108-L110 "Source code on GitHub"
[34]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L119-L121 "Source code on GitHub"
[35]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[36]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[37]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L130-L140 "Source code on GitHub"
[38]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L149-L154 "Source code on GitHub"
[39]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L163-L168 "Source code on GitHub"
[40]: https://github.com/Gmousse/dataframe-js/blob/add47391719e84537fdc30c80f762b3a8b38ba9a/src/row.js#L177-L184 "Source code on GitHub"