We have below sample data frame
+-----------+---------------+--------------+
|customer_id|age |post_code |
+-----------+---------------+--------------+
| 1001| 50| BS32 0HW |
+-----------+---------------+--------------+
Then we get a string like this
useful_info = 'Customer [customer_id] is [age] years old and lives at [post_code].'
This is one of the example string and it could be any string with column names in it. I just need to replace those column names with actual values.
Now I need to add useful_info column but replacing with column values i.e.
Expected data frame would be:
[Row(customer_id='1001', age=50, post_code='BS32 0HW', useful_info='Customer 1001 is 50 years old and lives at BS32 0HW.')]
Does anyone know how to do this?
<BR>character doing?