Skip to main content

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 Row checks may not work as expected (the Proxy is returned, not this)
  • 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

ParameterType
tableDataFrame
idxnumber

Returns

Row

Source

src/dataframe/row.ts:70

Properties

PropertyModifierType
idxreadonlynumber
tablepublicDataFrame

Accessors

cells

get cells(): Iterable <Cell>

Returns

Iterable <Cell>

Source

src/dataframe/row.ts:98

Methods

get()

get(columnName): any

Returns this row's value for the specified column

Parameters

ParameterType
columnNamestring

Returns

any

Source

src/dataframe/row.ts:112


toDart()

toDart(): any

Returns

any

Source

src/dataframe/row.ts:116


toMap()

toMap(): object

Returns a JS object with column names as keys and values as values.

Returns

object

Source

src/dataframe/row.ts:101