daft.DataFrame.with_column#

DataFrame.with_column(column_name: str, expr: daft.expressions.Expression, resource_request: daft.resource_request.ResourceRequest | None = None) daft.dataframe.dataframe.DataFrame[source]#

Adds a column to the current DataFrame with an Expression, equivalent to a select with all current columns and the new one

Example

>>> new_df = df.with_column('x+1', col('x') + 1)
Parameters
  • column_name (str) – name of new column

  • expr (Expression) – expression of the new column.

  • resource_request (resource_request.ResourceRequest) – a custom resource request for the execution of this operation

Returns

DataFrame with new column.

Return type

DataFrame