Skip to content

Instantly share code, notes, and snippets.

View kdbaseball8's full-sized avatar

Kevin D kdbaseball8

  • California
View GitHub Profile
@kdbaseball8
kdbaseball8 / flatten_all_spark_schema.py
Created February 27, 2021 17:05 — forked from AxREki/flatten_all_spark_schema.py
Flatten a Spark DataFrame schema (include struct and array type)
import typing as T
import cytoolz.curried as tz
import pyspark
from pyspark.sql.functions import explode
def schema_to_columns(schema: pyspark.sql.types.StructType) -> T.List[T.List[str]]: