timsaucer commented on code in PR #909:
URL: https://github.com/apache/datafusion-python/pull/909#discussion_r1798315618


##########
python/datafusion/dataframe.py:
##########
@@ -160,6 +160,40 @@ def with_column(self, name: str, expr: Expr) -> DataFrame:
         """
         return DataFrame(self.df.with_column(name, expr.expr))
 
+    def with_columns(
+        self, *exprs: Expr | Iterable[Expr], **named_exprs: Expr
+    ) -> DataFrame:
+        """Add an additional column to the DataFrame.
+
+        Args:
+            *exprs: Name of the column to add.
+            **named_exprs: Expression to compute the column.

Review Comment:
   By reading this docstring I didn't at first understand the correct usage. I 
think I'd go with something more along the lines of
   
   Add columns to the DataFrame.
   
   The user can pass expressions, iteratables of expressions, or named 
expressions. To pass named expressions use the form `name=Expr`. For example 
the following will add 4 columns labeled `a`, `b`, `c`, and `d`.
   
   ```
   df = df.with_columns(lit(0).alias('a'), [lit(1).alias('b'), 
lit(2).alias('c')], d=lit(3))
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to