Skip to content

Row

A one-dimensional collection of named, heterogeneous values.

You only need to interact with this class in callbacks passed to higher-order functions.

Stub code in Row.sdsstub

class Row {
    /**
     * The number of columns.
     */
    @PythonName("column_count") attr columnCount: Int
    /**
     * The names of the columns.
     */
    @PythonName("column_names") attr columnNames: List<String>
    /**
     * The schema of the row, which is a mapping from column names to their types.
     */
    attr schema: Schema

    /**
     * Get the cell in the specified column. This is equivalent to the `[]` operator (indexed access).
     *
     * @param name The name of the column.
     *
     * @result cell The cell in the specified column.
     *
     * @example
     * pipeline example {
     *     val table = Table({"col1": [1, 2], "col2": [3, 4]});
     *     out table.removeRows((row) -> row.getCell("col1") == 1);
     *     out table.removeRows((row) -> row["col1"] == 1);
     * }
     */
    @Pure
    @PythonName("get_cell")
    fun getCell(
        name: String
    ) -> cell: Cell<Any>

    /**
     * Get the type of a column.
     *
     * @param name The name of the column.
     *
     * @result type The type of the column.
     */
    @Pure
    @PythonName("get_column_type")
    fun getColumnType(
        name: String
    ) -> type: ColumnType

    /**
     * Check if the row has a column with a specific name. This is equivalent to the `in` operator.
     *
     * @param name The name of the column.
     *
     * @result hasColumn Whether the row has a column with the specified name.
     */
    @Pure
    @PythonName("has_column")
    fun hasColumn(
        name: String
    ) -> hasColumn: Boolean
}

columnCount

The number of columns.

Type: Int

columnNames

The names of the columns.

Type: List<String>

schema

The schema of the row, which is a mapping from column names to their types.

Type: Schema

getCell

Get the cell in the specified column. This is equivalent to the [] operator (indexed access).

Parameters:

Name Type Description Default
name String The name of the column. -

Results:

Name Type Description
cell Cell<Any> The cell in the specified column.

Examples:

pipeline example {
    val table = Table({"col1": [1, 2], "col2": [3, 4]});
    out table.removeRows((row) -> row.getCell("col1") == 1);
    out table.removeRows((row) -> row["col1"] == 1);
}
Stub code in Row.sdsstub

@Pure
@PythonName("get_cell")
fun getCell(
    name: String
) -> cell: Cell<Any>

getColumnType

Get the type of a column.

Parameters:

Name Type Description Default
name String The name of the column. -

Results:

Name Type Description
type ColumnType The type of the column.
Stub code in Row.sdsstub

@Pure
@PythonName("get_column_type")
fun getColumnType(
    name: String
) -> type: ColumnType

hasColumn

Check if the row has a column with a specific name. This is equivalent to the in operator.

Parameters:

Name Type Description Default
name String The name of the column. -

Results:

Name Type Description
hasColumn Boolean Whether the row has a column with the specified name.
Stub code in Row.sdsstub

@Pure
@PythonName("has_column")
fun hasColumn(
    name: String
) -> hasColumn: Boolean