0% found this document useful (0 votes)
21 views3 pages

Mongodb Assignment11

The document outlines the instructions for Assignment 11 in a Data Engineering Lab, requiring students to write well-commented code and submit a specific .ipynb file format. It includes details about a dataset related to food establishments and lists various queries to be executed, such as hygiene score and rating value queries. Additionally, it provides optional setup instructions for viewing JSON files in Visual Studio Code.

Uploaded by

samuelfyntan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Mongodb Assignment11

The document outlines the instructions for Assignment 11 in a Data Engineering Lab, requiring students to write well-commented code and submit a specific .ipynb file format. It includes details about a dataset related to food establishments and lists various queries to be executed, such as hygiene score and rating value queries. Additionally, it provides optional setup instructions for viewing JSON files in Visual Studio Code.

Uploaded by

samuelfyntan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Engineering Lab

Assignment 11

Instructions:
1. Provide commented, indented code. Variables should have meaningful names.
2. Write questions in separate text blocks before the code blocks containing answers.
3. Files to be submitted: .ipynb file containing code named as
‘YourName_YourRollNo_Assignment_No_.ipynb’

Pre - setup to be followed:


(if not installed: type : !pip3 install pymongo)
The dataset may include information about food establishments, such as:

● Name: The name of the restaurant or food business.


● Type: The type of establishment (e.g., restaurant, cafe, takeaway).
● Location: Address or geographical coordinates.
● Rating: Customer ratings or reviews.

Cuisine: Types of food served (e.g., Italian, Chinese, fast food).

To view JSON files prettily in Visual Studio Code (VS Code), follow these steps: (optional)

1. Open the JSON File:


○ Open your JSON file in VS Code by clicking on it in the Explorer
sidebar or dragging it into the editor.
2. Format the JSON:
○ you can right-click anywhere in the editor and select Format
Document.
Assignment Questions

1. Hygiene Score Query


○ (0.25) Find the number of establishments with a hygiene score equal to 20.
○ (0.50) Display the first document in the results.
○ (0.25) Convert the results to a Pandas DataFrame and display the number of
rows in the DataFrame.
2. Rating Value Query
○ (0.25) Count the number of establishments in London with a RatingValue
greater than or equal to 4.
○ (0.50) Cast the results into a list and display the first document using pprint.
○ (0.25) onvert the results to a DataFrame and display the first 10 rows.
3. Establishments by Rating
○ (0.25) Find the longitude and latitude values for the establishment with the
highest RatingValue.
○ (0.50) Display the name and rating of this establishment.
○ (0.25) If the establishment is found, convert the result to a Pandas
DataFrame and display its details.
4. Hygiene Score of Zero Query
○ (0.25) Use aggregation to find how many establishments in each Local
Authority have a hygiene score of 0.
○ (0.50) Print the number of unique Local Authorities that have establishments
with a hygiene score of 0.
○ (0.25) Convert the results to a Pandas DataFrame and display the number of
rows in the DataFrame.
5. Establishments by Business Type
○ (0.25) Find the number of unique business types available in the
establishments.
○ (0.50) Display the first 10 unique business types.
○ (0.25) Convert the unique business types to a Pandas DataFrame and
display the number of rows in the DataFrame.

Feel free to copy this updated question into your Jupyter Notebook.

You might also like