deanm0000 commented on issue #754:
URL: 
https://github.com/apache/datafusion-python/issues/754#issuecomment-2741575371

   Another potential friendly alias method is to use **kwargs in `select` and 
`aggregate`. Here's a select implementation:
   
   ```python
       def select(self, *exprs: Expr | str, **kwargs: Expr | str) -> DataFrame:
   
           exprs_internal = [
               Expr.column(arg).expr if isinstance(arg, str) else arg.expr for 
arg in exprs
           ]
           for name, expr_or_str in kwargs.items():
               if isinstance(expr_or_str, str):
                   expr_or_str=col(expr_or_str)
               exprs_internal.append(expr_or_str.alias(name))
           return DataFrame(self.df.select(*exprs_internal))
   ```


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to