Skip to content

Instantly share code, notes, and snippets.

View kdbaseball8's full-sized avatar

Kevin D kdbaseball8

  • California
View GitHub Profile
@AxREki
AxREki / flatten_all_spark_schema.py
Last active March 21, 2022 20:46 — forked from nguyenvulebinh/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]]: