albertoRamon opened a new issue, #1176:
URL: https://github.com/apache/datafusion-python/issues/1176

   **Describe the bug**
   There is a small typo in this manual: [Case 
Builder](https://datafusion.apache.org/python/autoapi/datafusion/expr/index.html#datafusion.expr.CaseBuilder)
 with the brackets 
   
       f.case(col("column_a"**))**  ##Here
       .when(lit(1), lit("One"))
       .when(lit(2), lit("Two"))
       .otherwise(lit("Unknown"))
   
   _AttributeError: 'Expr' object has no attribute 'when'_
   
   
   **To Reproduce**
   `from datafusion import SessionContext, col, lit, functions as f
   ctx = SessionContext()
   
   # Create sample data
   data = {"col_a": [1, 1, 2, 2, 2], "col_b": [10, 20, 30, 40, 50]}
   df = ctx.from_pydict(data)
   
   df=df.select(
       f.case(col("col_a"))
       .when(lit(1),lit("one"))
       .when(lit(2),lit("two"))
       .otherwise(lit("Unknown")).alias("f_case")
       )
   
   df.show()`
   
   **Expected behavior**
   <NA>
   
   **Additional context**
   <NA>
   


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