Row
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
Constructors
new Row()
new Row(
table,idx):Row
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
Source
Properties
| Property | Modifier | Type |
|---|---|---|
idx | readonly | number |
table | public | DataFrame |
Accessors
cells
getcells():Iterable<Cell>
Returns
Iterable <Cell>
Source
Methods
get()
get(
columnName):any
Returns this row's value for the specified column
Parameters
| Parameter | Type |
|---|---|
columnName | string |
Returns
any
Source
toDart()
toDart():
any
Returns
any
Source
toMap()
toMap():
object
Returns a JS object with column names as keys and values as values.
Returns
object