Struct and Array¶
Struct ¶
Bases: Column[StructType], _Base
group ¶
group() -> Self
Mark column as a group key for use in an aggregate DataFrame constructor.
Example::
class Agg(ts.DataFrame):
name: ts.String
total: ts.Int
Agg(df, name=df.name.group(), total=ts.sum(df.age))
The returned value is a _GroupColumn sentinel. Arithmetic and comparison
operations on it raise TypeError — operate on the field after construction
instead.
cast ¶
cast(dataType: BooleanType) -> Bool
cast(dataType: BinaryType) -> Binary
cast(dataType: DecimalType) -> Decimal
cast(dataType: DoubleType) -> Double
cast(dataType: IntegerType) -> Integer
cast(dataType: StringType) -> String
cast(dataType: TimestampType) -> Timestamp
cast(dataType: TimestampNTZType) -> TimestampNTZ
cast(dataType: U) -> Column[U]
over ¶
over(window: WindowSpec | WindowSpec) -> Self
Evaluate this column over a window, like pyspark.sql.Column.over.
An aggregate (tsf.sum(col).over(w)) becomes a plain column of the same
type, so the DataFrame constructor projects it instead of grouping.
Array ¶
from_json
classmethod
¶
explode ¶
explode() -> T
explode(access: Callable[[T], U]) -> U
One row per array element.
Without access the result is the element itself. With access,
the result is whatever access builds from the element, e.g.
df.areas.explode(lambda a: a.id). The access is deferred: the
element only exists once the explode has run, so any expression on it —
field access, casts, functions — must go inside access.
Several explode() calls on the same array column share one explode.