snowflake.snowpark.DataFrame.withColumn¶
- DataFrame.withColumn(col_name: str, col: Union[Column, TableFunctionCall]) DataFrame[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/dataframe.py#L2712-L2756)¶
Returns a DataFrame with an additional column with the specified name
col_name. The column is computed by using the specified expressioncol.If a column with the same name already exists in the DataFrame, that column is replaced by the new column.
Example 1:
Example 2:
- Parameters:
col_name – The name of the column to add or replace.
col – The
Columnortable_function.TableFunctionCallwith single column output to add or replace.