Skip to content

Instantly share code, notes, and snippets.

@2XXE-SRA
Created June 24, 2020 16:12
Show Gist options
  • Save 2XXE-SRA/77f7131294bce2cab2ec88d628e3a6ae to your computer and use it in GitHub Desktop.
Save 2XXE-SRA/77f7131294bce2cab2ec88d628e3a6ae to your computer and use it in GitHub Desktop.
Python dict to Spark Row in Databricks
from pyspark.sql import Row
# mydict is something like {"abc":"def", "ghi":"jkl"}
computer = Row(*mydict.keys())
rows = [computer(*mydict.values())]
display(spark.createDataFrame(row))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment