Question: Using Databricks community: Create another notebook with the language set to Python. Use the spark command to create a spark object Use the spark.sql to
Using Databricks community:
Create another notebook with the language set to Python.
Use the spark command to create a spark object
Use the spark.sql to create a dataframe name it firecalls as follows:
===========================Copy this section to your notebook=================
spark
firecalls = spark.sql("select * from firecallsuploaded")
=====================================================================
Note if your working on a notebook with the default language not set to Python, you have to start each cell with Python code with the command %Python
(hint use display command for formatting the query output in a table format)
Use Python to work on the firecalls dataframe and answer the following questions:
1) Write a Python query to retrieve the address of the first 20 lines of the data.
2) Write a Python query to retrieve the number of fire calls by each neighborhood district, order them descending.
3) Write a Python query to retrieve the number of fire calls from this address '1485 Bayshore Bl. Hint the filter command takes input as string filter(column == value)
4) Write a Python query to retrieve the number of fire calls form this Zipcode '94121'
5) Write a Python query to retrieve the data by neighborhood_district form this Zipcode '94121'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
