Hi @arkiboys ,
Thanks for posting question on Microsoft Q&A platform.
expr function converts string into an expression. In your case, you already have "expression" variable which is holding a column expression of a dataframe.
While trying to use withColumn function on top of your dataframe, it expects the input parameter as (colName, col) where col is nothing but a column expression.
expr function is not needed in this case. Kindly check the below screenshot for your reference.
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on
or upvote
button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators