daft.DataFrame.with_column
daft.DataFrame.with_column#
- DataFrame.with_column(column_name: str, expr: daft.expressions.expressions.Expression, resource_request: daft.resource_request.ResourceRequest = ResourceRequest(num_cpus=None, num_gpus=None, memory_bytes=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 oneExample
>>> 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 (ResourceRequest) – a custom resource request for the execution of this operation
- Returns
DataFrame with new column.
- Return type