In this homework, you will use PySpark in Google Colab to build a small SQL-style analytics report.
You will:
- create a PySpark DataFrame in Colab
- add a calculated column
- register a temporary SQL view
- write analytics queries with Spark SQL
- explain one result in plain English
Create a Colab notebook named:
session-08-homework-pyspark-analyticsYour notebook should:
- Install PySpark.
- Start a Spark session.
- Create a DataFrame with at least 12 rows.
- Use a dataset about one of these topics:
- online orders
- student scores
- movie ratings
- app events
- Add at least one calculated column.
- Register a temporary SQL view.
- Write at least 4 SQL queries.
- Include at least one grouped summary with
GROUP BY. - Include at least one sorted result with
ORDER BY. - Stop Spark at the end.
Create this file:
session8/solutions/exercise-08-homework.mdYour markdown file should include:
# Session 8 Homework
## Colab notebook
Link:
## Dataset topic
Describe your rows and columns.
## Calculated column
What column did you add, and how did you calculate it?
## SQL queries
Paste your 4 SQL queries.
## Results
Explain 2 interesting results in plain English.
## Reflection
What felt easier in Spark SQL than DataFrame syntax? What felt harder?- Use PySpark.
- Use Google Colab unless you completed the local setup in Part 3.
- Use at least 12 rows.
- Do not use pandas for the main analytics queries.
- Stop Spark at the end of the notebook.
Post your completed session8/solutions/exercise-08-homework.md in the class discussion forum.
quizmd quizzes/python-session-08-homework-quiz.md