Enabler
Functions
| Name | Description |
|---|---|
ensure_column | Enables PySpark functions to accept either column names (as strings) or Column objects. |
ensure_list | Ensures the input is returned as a list. |
ensure_columnfunction#
def ensure_column(*columns: ColumnOrName) -> tuple[Column, ...]Enables PySpark functions to accept either column names (as strings) or Column objects.
Parameters: columns (ColumnOrName): Column names (as strings) or Column objects to be converted.
Returns: tuple[Column]: A tuple of Column objects.
Example:
>>> ensure_column("col1", "col2", F.col("col3"))(Column<b'col1'>, Column<b'col2'>, Column<b'col3'>)ensure_listfunction#
def ensure_list(single_or_list: Any | list[Any]) -> list[Any]Ensures the input is returned as a list.
If the input is not already a list, it wraps the input in a list. If the input is already a list, it returns the input unchanged.
Parameters