Skip to content

Commit b2fc588

Browse files
committed
chore: add doc
1 parent 35656f1 commit b2fc588

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

python/datafusion/dataframe.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,20 @@ def with_column(self, name: str, expr: Expr) -> DataFrame:
163163
def with_columns(
164164
self, *exprs: Expr | Iterable[Expr], **named_exprs: Expr
165165
) -> DataFrame:
166-
"""Add an additional column to the DataFrame.
166+
"""Add columns to the DataFrame.
167+
168+
By passing expressions, iteratables of expressions, or named expressions. To
169+
pass named expressions use the form name=Expr.
170+
171+
Example usage:
172+
173+
The following will add 4 columns labeled a, b, c, and d.
174+
175+
df = df.with_columns(
176+
lit(0).alias('a'),
177+
[lit(1).alias('b'), lit(2).alias('c')],
178+
d=lit(3)
179+
)
167180
168181
Args:
169182
*exprs: Name of the column to add.

0 commit comments

Comments
 (0)