检查点
数据框简介
了解 DataFrames 是什么,为什么它们在 Databricks 中的 PySpark 中至关重要,以及分布式数据的工作原理。
...
Distributed data processing diagram
...
Data flow: User to Spark processing
...
Creating a DataFrame by converting raw data into Spark DataFrame
...
Checking the schema of employee table
...
Transforming the data by adding 5000 in SalaryAfterBonus of employees
Table
| Name | Age | City |
|---|---|---|
| Ali | 28 | Lahore |
| Sara | 24 | Karachi |
| John | 30 | London |
1from pyspark.sql import Row 2 3# Step 1: Create rows of data 4data = [ 5 Row(name="Ali", age=28, city="Lahore"), 6 Row(name="Sara", age=24, city="Karachi"), 7 Row(name="John", age=30, city="London") 8] 9 10# Step 2: Convert to DataFrame 11df = spark.createDataFrame(data) 12 13# Step 3: Display the data 14df.show() 15 16# Step 4: Inspect the structure 17df.printSchema()
1from pyspark.sql import Row 2 3# Step 1: Create rows of data 4data = [ 5 Row(name="Ali", age=28, city="Lahore"), 6 Row(name="Sara", age=24, city="Karachi"), 7 Row(name="John", age=30, city="London") 8] 9 10# Step 2: Convert to DataFrame 11df = spark.createDataFrame(data) 12 13# Step 3: Display the data 14df.show() 15 16# Step 4: Inspect the structure 17df.printSchema()
Quiz
单选题
在 Databricks 中,什么最能描述 DataFrame?
1 / 4