Created
June 24, 2020 16:12
-
-
Save 2XXE-SRA/77f7131294bce2cab2ec88d628e3a6ae to your computer and use it in GitHub Desktop.
Python dict to Spark Row in Databricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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