Skip to content

Cell

A single value in a table.

This class cannot be instantiated directly. It is only used for arguments of callbacks.

Type parameters:

Name Upper Bound Description Default
T Any? - Any?
Stub code in Cell.sdsstub
class Cell<out T = Any?> {
    /**
     * Namespace for operations on strings.
     */
    attr str: StringCell
    /**
     * Namespace for operations on date time values.
     */
    @Experimental
    attr dt: TemporalCell

    /**
     * Return the first cell from the given list that is not None.
     *
     * @param cells The list of cells to be searched.
     *
     * @result cell Returns the contents of the first cell that is not None.
     * If all cells in the list are None or the list is empty returns None.
     */
    @Pure
    @PythonName("first_not_none")
    static fun firstNotNone(
        cells: List<Cell<Any?>>
    ) -> cell: Cell<Any?>

    /**
     * Negate a boolean. This WILL LATER BE equivalent to the ^not operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [true, false]);
     *     val result = column.transform((cell) -> cell.^not());
     *     // Column("example", [false, true])
     * }
     */
    @Pure
    @PythonName("not_")
    fun ^not() -> result: Cell<Boolean>

    /**
     * Perform a boolean AND operation. This WILL LATER BE equivalent to the ^and operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [true, false]);
     *     val result = column.transform((cell) -> cell.^and(false));
     *     // Column("example", [false, false])
     * }
     */
    @Pure
    @PythonName("and_")
    fun ^and(
        other: union<Boolean, Cell<Boolean>>
    ) -> result: Cell<Boolean>

    /**
     * Perform a boolean OR operation. This WILL LATER BE equivalent to the ^or operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [true, false]);
     *     val result = column.transform((cell) -> cell.^or(true));
     *     // Column("example", [true, true])
     * }
     */
    @Pure
    @PythonName("or_")
    fun ^or(
        other: union<Boolean, Cell<Boolean>>
    ) -> result: Cell<Boolean>

    /**
     * Perform a boolean XOR operation.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [true, false]);
     *     val result = column.transform((cell) -> cell.xor(true));
     *     // Column("example", [false, true])
     * }
     */
    @Pure
    fun xor(
        other: union<Boolean, Cell<Boolean>>
    ) -> result: Cell<Boolean>

    /**
     * Get the absolute value.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, -2]);
     *     val result = column.transform((cell) -> cell.abs());
     *     // Column("example", [1, 2])
     * }
     */
    @Pure
    fun abs() -> result: Cell

    /**
     * Round up to the nearest integer.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1.1, 2.9]);
     *     val result = column.transform((cell) -> cell.ceil());
     *     // Column("example", [2, 3])
     * }
     */
    @Pure
    fun ceil() -> result: Cell

    /**
     * Round down to the nearest integer.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1.1, 2.9]);
     *     val result = column.transform((cell) -> cell.floor());
     *     // Column("example", [1, 2])
     * }
     */
    @Pure
    fun floor() -> result: Cell

    /**
     * Negate the value.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, -2]);
     *     val result = column.transform((cell) -> cell.neg());
     *     // Column("example", [-1, 2])
     * }
     */
    @Pure
    fun neg() -> result: Cell

    /**
     * Add a value. This WILL LATER BE equivalent to the `+` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.add(3));
     *     // Column("example", [4, 5])
     * }
     */
    @Pure
    fun add(
        other: Any
    ) -> result: Cell

    /**
     * Divide by a value. This WILL LATER BE equivalent to the `/` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [6, 8]);
     *     val result = column.transform((cell) -> cell.div(2));
     *     // Column("example", [3, 4])
     * }
     */
    @Pure
    fun div(
        other: Any
    ) -> result: Cell

    /**
     * Perform a modulo operation.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [5, 6]);
     *     val result = column.transform((cell) -> cell.mod(3));
     *     // Column("example", [2, 0])
     * }
     */
    @Pure
    fun mod(
        other: Any
    ) -> result: Cell

    /**
     * Multiply by a value. This WILL LATER BE equivalent to the `*` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [2, 3]);
     *     val result = column.transform((cell) -> cell.mul(4));
     *     // Column("example", [8, 12])
     * }
     */
    @Pure
    fun mul(
        other: Any
    ) -> result: Cell

    /**
     * Raise to a power.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [2, 3]);
     *     val result = column.transform((cell) -> cell.pow(3.0));
     *     // Column("example", [8, 27])
     * }
     */
    @Pure
    fun pow(
        other: union<Cell, Float>
    ) -> result: Cell

    /**
     * Subtract a value. This WILL LATER BE equivalent to the `-` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [5, 6]);
     *     val result = column.transform((cell) -> cell.^sub(3));
     *     // Column("example", [2, 3])
     * }
     */
    @Pure
    fun ^sub(
        other: Any
    ) -> result: Cell

    /**
     * Check if equal to a value. This WILL LATER BE equivalent to the `==` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.eq(2));
     *     // Column("example", [false, true])
     * }
     */
    @Pure
    fun eq(
        other: Any
    ) -> result: Cell<Boolean>

    /**
     * Check if greater than or equal to a value. This WILL LATER BE equivalent to the `>=` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.ge(2));
     *     // Column("example", [false, true])
     * }
     */
    @Pure
    fun ge(
        other: Any
    ) -> result: Cell<Boolean>

    /**
     * Check if greater than a value. This WILL LATER BE equivalent to the `>` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.gt(2));
     *     // Column("example", [false, false])
     * }
     */
    @Pure
    fun gt(
        other: Any
    ) -> result: Cell<Boolean>

    /**
     * Check if less than or equal to a value. This WILL LATER BE equivalent to the `<=` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.le(2));
     *     // Column("example", [true, true])
     * }
     */
    @Pure
    fun le(
        other: Any
    ) -> result: Cell<Boolean>

    /**
     * Check if less than a value. This WILL LATER BE equivalent to the `<` operator.
     *
     * @example
     * pipeline example {
     *     val column = Column("example", [1, 2]);
     *     val result = column.transform((cell) -> cell.lt(2));
     *     // Column("example", [true, false])
     * }
     */
    @Pure
    fun lt(
        other: Any
    ) -> result: Cell<Boolean>
}

🧪 dt

Namespace for operations on date time values.

Type: TemporalCell

str

Namespace for operations on strings.

Type: StringCell

abs

Get the absolute value.

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [1, -2]);
    val result = column.transform((cell) -> cell.abs());
    // Column("example", [1, 2])
}
Stub code in Cell.sdsstub
@Pure
fun abs() -> result: Cell

add

Add a value. This WILL LATER BE equivalent to the + operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.add(3));
    // Column("example", [4, 5])
}
Stub code in Cell.sdsstub
@Pure
fun add(
    other: Any
) -> result: Cell

and

Perform a boolean AND operation. This WILL LATER BE equivalent to the ^and operator.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Boolean>> - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [true, false]);
    val result = column.transform((cell) -> cell.^and(false));
    // Column("example", [false, false])
}
Stub code in Cell.sdsstub
@Pure
@PythonName("and_")
fun ^and(
    other: union<Boolean, Cell<Boolean>>
) -> result: Cell<Boolean>

ceil

Round up to the nearest integer.

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [1.1, 2.9]);
    val result = column.transform((cell) -> cell.ceil());
    // Column("example", [2, 3])
}
Stub code in Cell.sdsstub
@Pure
fun ceil() -> result: Cell

div

Divide by a value. This WILL LATER BE equivalent to the / operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [6, 8]);
    val result = column.transform((cell) -> cell.div(2));
    // Column("example", [3, 4])
}
Stub code in Cell.sdsstub
@Pure
fun div(
    other: Any
) -> result: Cell

eq

Check if equal to a value. This WILL LATER BE equivalent to the == operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.eq(2));
    // Column("example", [false, true])
}
Stub code in Cell.sdsstub
@Pure
fun eq(
    other: Any
) -> result: Cell<Boolean>

floor

Round down to the nearest integer.

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [1.1, 2.9]);
    val result = column.transform((cell) -> cell.floor());
    // Column("example", [1, 2])
}
Stub code in Cell.sdsstub
@Pure
fun floor() -> result: Cell

ge

Check if greater than or equal to a value. This WILL LATER BE equivalent to the >= operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.ge(2));
    // Column("example", [false, true])
}
Stub code in Cell.sdsstub
@Pure
fun ge(
    other: Any
) -> result: Cell<Boolean>

gt

Check if greater than a value. This WILL LATER BE equivalent to the > operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.gt(2));
    // Column("example", [false, false])
}
Stub code in Cell.sdsstub
@Pure
fun gt(
    other: Any
) -> result: Cell<Boolean>

le

Check if less than or equal to a value. This WILL LATER BE equivalent to the <= operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.le(2));
    // Column("example", [true, true])
}
Stub code in Cell.sdsstub
@Pure
fun le(
    other: Any
) -> result: Cell<Boolean>

lt

Check if less than a value. This WILL LATER BE equivalent to the < operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [1, 2]);
    val result = column.transform((cell) -> cell.lt(2));
    // Column("example", [true, false])
}
Stub code in Cell.sdsstub
@Pure
fun lt(
    other: Any
) -> result: Cell<Boolean>

mod

Perform a modulo operation.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [5, 6]);
    val result = column.transform((cell) -> cell.mod(3));
    // Column("example", [2, 0])
}
Stub code in Cell.sdsstub
@Pure
fun mod(
    other: Any
) -> result: Cell

mul

Multiply by a value. This WILL LATER BE equivalent to the * operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [2, 3]);
    val result = column.transform((cell) -> cell.mul(4));
    // Column("example", [8, 12])
}
Stub code in Cell.sdsstub
@Pure
fun mul(
    other: Any
) -> result: Cell

neg

Negate the value.

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [1, -2]);
    val result = column.transform((cell) -> cell.neg());
    // Column("example", [-1, 2])
}
Stub code in Cell.sdsstub
@Pure
fun neg() -> result: Cell

not

Negate a boolean. This WILL LATER BE equivalent to the ^not operator.

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [true, false]);
    val result = column.transform((cell) -> cell.^not());
    // Column("example", [false, true])
}
Stub code in Cell.sdsstub
@Pure
@PythonName("not_")
fun ^not() -> result: Cell<Boolean>

or

Perform a boolean OR operation. This WILL LATER BE equivalent to the ^or operator.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Boolean>> - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [true, false]);
    val result = column.transform((cell) -> cell.^or(true));
    // Column("example", [true, true])
}
Stub code in Cell.sdsstub
@Pure
@PythonName("or_")
fun ^or(
    other: union<Boolean, Cell<Boolean>>
) -> result: Cell<Boolean>

pow

Raise to a power.

Parameters:

Name Type Description Default
other union<Cell<Any?>, Float> - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [2, 3]);
    val result = column.transform((cell) -> cell.pow(3.0));
    // Column("example", [8, 27])
}
Stub code in Cell.sdsstub
@Pure
fun pow(
    other: union<Cell, Float>
) -> result: Cell

sub

Subtract a value. This WILL LATER BE equivalent to the - operator.

Parameters:

Name Type Description Default
other Any - -

Results:

Name Type Description
result Cell<Any?> -

Examples:

pipeline example {
    val column = Column("example", [5, 6]);
    val result = column.transform((cell) -> cell.^sub(3));
    // Column("example", [2, 3])
}
Stub code in Cell.sdsstub
@Pure
fun ^sub(
    other: Any
) -> result: Cell

xor

Perform a boolean XOR operation.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Boolean>> - -

Results:

Name Type Description
result Cell<Boolean> -

Examples:

pipeline example {
    val column = Column("example", [true, false]);
    val result = column.transform((cell) -> cell.xor(true));
    // Column("example", [false, true])
}
Stub code in Cell.sdsstub
@Pure
fun xor(
    other: union<Boolean, Cell<Boolean>>
) -> result: Cell<Boolean>

firstNotNone

Return the first cell from the given list that is not None.

Parameters:

Name Type Description Default
cells List<Cell<Any?>> The list of cells to be searched. -

Results:

Name Type Description
cell Cell<Any?> Returns the contents of the first cell that is not None. If all cells in the list are None or the list is empty returns None.
Stub code in Cell.sdsstub
@Pure
@PythonName("first_not_none")
static fun firstNotNone(
    cells: List<Cell<Any?>>
) -> cell: Cell<Any?>