In Spark SQL, flatten nested struct column (convert struct to columns) of a DataFrame is simple for one level of the hierarchy and complex when you have
PySpark: Flatten Struct If you have already loaded the dataframe as df1, the following solution can be used to flatten multiple nested struct layers. This is a more generic solution and can be called with a second parameter indicating the number of layers to be flattened (in this case, 3)....