Explode and Explode_Outer in PySpark| Databricks |

Опубликовано: 07 Октябрь 2024
на канале: GeekCoders
1,402
26

Hey Geeks,

from pyspark.sql.types import (
StructType,
StructField,
StringType,
IntegerType,
ArrayType,
)
from pyspark.sql.functions import explode, explode_outer

data = [
(1, "Sagar", [20, 30, 40]),
(2, "Alex", [40, 20, 10]),
(3, "John", []),
(4, "Kim", [20, 1, None]),
]
data=[(1,'Sagar',[20,30,40]),(2,'Alex',[40,20,10])]
schema = StructType(
[
StructField("ID", IntegerType(), True),
StructField("Name", StringType(), False),
StructField("Marks", ArrayType(IntegerType()), True),
]
)
df = spark.createDataFrame(data, schema=schema)
display(df)

Databricks and PySpark:
https://www.geekcoders.co.in/courses/...

Build Real-Time DeltaLake Project using PySpark and Spark-SQL with Databricks:
https://www.geekcoders.co.in/courses/...

Full Playlist of Interview Questions of SQL:
✅   • 1.Second Highest Salary (Top 20 SQL I...  
Full Playlist of Snowflake SQL:
✅   • How to setup Free Account on Snowflak...  
Full Playlist of Golang:
✅    • Hello World Program | Golang Tutorial...  
Full Playlist of NumPY Library:
✅    • Hello World Program | Golang Tutorial...  
Full Playlist of PTQT5:
✅ https://www.youtube.com/watch?v=NcATA...
Full Playlist of Pandas:
✅    • How to use PandasGUI for Exploratory ...  

YouTube Link:    / @geekcoders  
Instagram:   / prajaji  

pyspark tutorial
azure data factory
pyspark
data engineer roadmap
azure databricks
databricks tutorial
pyspark tutorial for beginners


#azuredataengineer #explode

#databricksforbeginner #databricks