Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 11:01 PM
if the structure does not change all the time you could use the renaming of columns in a more automated way like described here.
But this example does not handle nested columns.
You could also try to create a schema without spaces and pass that when you read the data.
This can be done manually or programatically (although this can be a challenge for deeply nested structures).
The second method seems better imo. As the schema method returns a nested list/array/...
Python and Scala have quite some collection parsing possibilities. Also the fact that the StructField type has an attribute called 'name' is useful.