Ultimate access to all questions.
You are given the following PySpark DataFrame storesDF:
from pyspark.sql import Row
data = [
Row(id=1, name="Store A", details=Row(sqft=1200, street="Main Street")),
Row(id=2, name="Store B", details=Row(sqft=1500, street="Broadway"))
]
storesDF = spark.createDataFrame(data)
storesDF.printSchema()
Schema:
root
|-- id: long (nullable = true)
|-- name: string (nullable = true)
|-- details: struct (nullable = true)
| |-- sqft: long (nullable = true)
| |-- street: string (nullable = true)
You need to extract the sqft value from the details struct of the first row as a Python int.
Fill in the blanks in the following code: int(1.2()[3][4])