Row
Defined in: src/dataframe/row.ts:60
Represents a row in a DataFrame.
This class uses a JavaScript Proxy to allow convenient property access using column names:
const row = df.row(0);
console.log(row.age); // Access column 'age' value
row.name = 'Alice'; // Set column 'name' value
Why a Proxy?
The Row constructor returns a Proxy that intercepts property access. When you access
row.columnName, the Proxy checks if it's a built-in property (table, idx, cells,
get, toDart, toMap). If not, it delegates to table.get(columnName, idx).
This provides a convenient syntax but has implications:
instanceof Rowchecks may not work as expected (the Proxy is returned, notthis)- TypeScript cannot provide autocomplete for column names at compile time
- There's slight overhead from the Proxy indirection
Alternative access patterns:
For performance-critical code or when you need type safety, use these alternatives:
// Using get() method
const age = row.get('age');
// Direct column access (most performant for bulk operations)
const ageColumn = df.getCol('age');
for (let i = 0; i < df.rowCount; i++) {
const age = ageColumn.get(i);
}
// Using toMap() for a plain object representation
const rowData = row.toMap(); // { age: 25, name: 'Alice', ... }
Indexable
[
columnName:string]:any
Returns this row's value for the specified column
Constructors
Constructor
new Row(
table,idx):Row
Defined in: src/dataframe/row.ts:70
Creates a Row from the specified DataFrame and row index.
Note: The constructor returns a Proxy, not the Row instance directly.
This allows dynamic property access but means instanceof Row checks may fail.
Parameters
| Parameter | Type |
|---|---|
table | DataFrame |
idx | number |
Returns
Row
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
idx | readonly | number | src/dataframe/row.ts:62 |
table | public | DataFrame | src/dataframe/row.ts:61 |
Accessors
cells
Get Signature
get cells():
Iterable<Cell>
Defined in: src/dataframe/row.ts:98
Returns
Iterable<Cell>
Methods
get()
get(
columnName):any
Defined in: src/dataframe/row.ts:112
Returns this row's value for the specified column
Parameters
| Parameter | Type |
|---|---|
columnName | string |
Returns
any
toDart()
toDart():
any
Defined in: src/dataframe/row.ts:116
Returns
any
toMap()
toMap():
object
Defined in: src/dataframe/row.ts:101
Returns a JS object with column names as keys and values as values.
Returns
object