I have dataframe as follows
+----------+--------------------+
|CustomerNo| desc |
+----------+--------------------+
| 351856.0| FORM & BEAUTY 075 P|
| 351856.0| FORM & BEAUTY 075 P|
| 326022.0| D 151 HP|
| 69430.0|Shape Sensation 0...|
| 38018.0| Maximizer 846 WHU|
| 69712.0|Shape Sensation 0...|
| 71228.0| Aqua Festive WHUD|
| 71228.0|Maximizer 736 WHU...|
| 73200.0| T-Shirt Bra 081 HP|
| 73200.0| T-Shirt Bra 081 HP|
| 73200.0| T-Shirt Bra 081 HP|
| 74540.0|Form & Beauty 052 HP|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
| 74578.0| G 56 WP 01|
+----------+--------------------+
I need to group by the data on CustomerNo and concatenate the string column.
I am using the below code but it is giving error
df = retail_df.groupBy('CustomerNo').agg(F.concat('desc').alias('concat_Desc'))
Can anyone tell me how to do this?