ion-elgreco opened a new pull request, #909:
URL: https://github.com/apache/datafusion-python/pull/909

   # Which issue does this PR close?
   -  closes https://github.com/apache/datafusion-python/issues/838
   
    # Rationale for this change
   Gives more flexibility to the user.
   
   # What changes are included in this PR?
   Adds a `with_columns` which is a wrapper around with_column in Rust, the 
schema_name of the expr is used as the name. However I think we could improve 
over this in a follow up:
   
   See this example of Polars VS Datafusion now:
   
   original df
   ```python
   +---+---+---+
   | a | b | c |
   +---+---+---+
   | 1 | 4 | 8 |
   | 2 | 5 | 5 |
   | 3 | 6 | 8 |
   +---+---+---+
   ```
   
   Polars
   ```python
   df.with_columns(pl.col('a)+5)
   ┌─────┬─────┬─────┐
   │ a   ┆ b   ┆ c   │
   │ --- ┆ --- ┆ --- │
   │ i64 ┆ i64 ┆ i64 │
   ╞═════╪═════╪═════╡
   │ 6   ┆ 4   ┆ 8   │
   │ 7   ┆ 5   ┆ 5   │
   │ 8   ┆ 6   ┆ 8   │
   └─────┴─────┴─────┘
   ```
   
   Datafusion
   ```python
   df.with_columns(column('a')+5)
   +---+---+---+--------------+
   | a | b | c | a + Int64(5) |
   +---+---+---+--------------+
   | 1 | 4 | 8 | 6            |
   | 2 | 5 | 5 | 7            |
   | 3 | 6 | 8 | 8            |
   +---+---+---+--------------+
   ```
   
   # Are there any user-facing changes?
   Adds new `with_columns` method on DataFrame.
   
   


-- 
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