Array type column in pyspark

Published: 27 December 2025
on channel: Laksh
11
0

Array type column in pyspark #pysparktutorial #dataengineering


from pyspark.sql.functions import *
from pyspark.sql.types import *




schema = [
"emp_id",
"name",
"skills"]

Data
data = [
(1, "Amit", ["Python", "SQL", "Spark"]),
(2, "Sumit", ["Java", "Spring","C"]),
(3, "Neeta", ["Scala", "Spark", "Kafka"])
]



df = spark.createDataFrame(data, schema)
df.show(truncate=False)

#df.printSchema()

df.select("emp_id",col("skills")[0].alias("Firstskill")).show()
df.select("emp_id",col("skills")[1].alias("Secondskill")).show()
df.select("emp_id",col("skills")[2].alias("THirdkill")).show()
#df.select("emp_id",col("skills").getItem(2).alias("Thirdskill")).show()


On this page of the site you can watch the video online Array type column in pyspark with a duration of hours minute second in good quality, which was uploaded by the user Laksh 27 December 2025, share the link with friends and acquaintances, this video has already been watched 11 times on youtube and it was liked by 0 viewers. Enjoy your viewing!