Join Slack
Powered by
Is there a way to roll a list of columns up into a...
# general
k
Kyle
09/27/2024, 6:01 AM
Is there a way to roll a list of columns up into a single column like this pyspark function?
Copy code
df = df.withColumn("info", F.to_json(struct([df[x] for x in df.columns])))
Kyle
09/27/2024, 3:05 PM
Oh okay I did this in the end
daft.to
_struct(*df.columns)
2
Views
Open in Slack
Previous
Next