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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started