Quiz1 SHU Solved 19/11/2023, 12:57 AM Quiz 1: Dataset - Laptops Pricing Estimated time needed: 30 minutes In this quiz, you will practice the process of loading and drawing basic insights on a dataset as learnt through the course. You are being provided with a fresh dataset on 'Laptop Pricing' which will be used for all the practice labs throughout this quiz. Objectives After completing this lab you will be able to: Import a dataset from a CSV file to a Pandas dataframe Develop some basic insights about the dataset Extract and interpret descriptive statistics of the dataset series Setup For this lab, we will be using the following libraries: [ pandas ] for managing the data. [ numpy ] for mathematical operations. Importing Required Libraries http://localhost:8888/nbconvert/html/Google%20Drive/My%20Drive/…ta%20analytics/19Nov/Quiz1%20SHU%20Solved.ipynb?download=false Page 1 of 5 Quiz1 SHU Solved 19/11/2023, 12:57 AM In [29]: import pandas as pd import numpy as np df=pd.read_csv("./laptops.csv") # create headers list headers = ["Manufacturer", "Category", "Screen", "GPU", "OS", "CPU_core", "Scre df.columns = headers The data set to be used has been imported. Task #1: Print the first 7 entries of the dataset to confirm loading. [1 mark] In [30]: # Write your code below and press Shift+Enter to execute. df.head(7) Manufacturer Category Screen GPU OS CPU_core Screen_Size_inch CPU_frequency 0 Dell 3 Full HD 1 1 3 39.624 2.0 1 Dell 3 Full HD 1 1 7 39.624 2.7 2 Dell 4 IPS Panel 2 1 5 33.782 1.6 3 HP 4 Full HD 2 1 7 39.624 1.8 4 Dell 3 Full HD 1 1 5 39.624 1.6 5 HP 3 Full HD 3 1 5 39.624 1.6 6 Acer 3 IPS Panel 2 1 5 38.1 1.6 Out[30]: Task #2: What is the number of rows and columns in the data? [1 mark] In [31]: df.shape Out[31]: (237, 12) Write your answer here 237 by 12 http://localhost:8888/nbconvert/html/Google%20Drive/My%20Drive/…ta%20analytics/19Nov/Quiz1%20SHU%20Solved.ipynb?download=false Page 2 of 5 Quiz1 SHU Solved 19/11/2023, 12:57 AM Task #3: What is the screen size of the entry number 17 of this data? [1 mark] In [32]: # Write your code below and press Shift+Enter to execute. df.loc[16] Out[32]: Manufacturer Dell Category 3 Screen Full HD GPU 1 OS 1 CPU_core 7 Screen_Size_inch 39.624 CPU_frequency 1.8 RAM_GB 8 Storage_GB_SSD 256 Weight_kg 2.2 Price 1105 Name: 16, dtype: object Write your answer here 39.624 Task #4: What is the average price of all Dell laptops in the data set? [2 marks] In [33]: # Write your code below and press Shift+Enter to execute. df.groupby('Manufacturer')['Price'].mean() Out[33]: Manufacturer Acer 1072.111111 Asus 1327.111111 Dell 1495.084507 HP 1399.285714 Huawei 1714.000000 Lenovo 1493.096154 MSI 1452.750000 Razer 3301.000000 Samsung 2107.400000 Toshiba 1703.882353 Xiaomi 1188.000000 Name: Price, dtype: float64 Write you answer here http://localhost:8888/nbconvert/html/Google%20Drive/My%20Drive/…ta%20analytics/19Nov/Quiz1%20SHU%20Solved.ipynb?download=false Page 3 of 5 Quiz1 SHU Solved 19/11/2023, 12:57 AM 1495.084507 Task #5: How many laptops of brand Toshiba does this store have? [2 mark] In [34]: # Write your code below and press Shift+Enter to execute. print(df.groupby('Manufacturer')['Price'].nunique()) Manufacturer Acer 18 Asus 17 Dell 65 HP 45 Huawei 1 Lenovo 49 MSI 4 Razer 1 Samsung 5 Toshiba 16 Xiaomi 1 Name: Price, dtype: int64 Write your answer here 16 Task #5: Which Brand has the most expensive laptop in the dataset? [2 mark] In [35]: print(df.groupby('Manufacturer')['Price'].max()) Manufacturer Acer 1650 Asus 3810 Dell 3665 HP 3073 Huawei 1714 Lenovo 3810 MSI 1714 Razer 3301 Samsung 2349 Toshiba 2509 Xiaomi 1188 Name: Price, dtype: int64 http://localhost:8888/nbconvert/html/Google%20Drive/My%20Drive/…ta%20analytics/19Nov/Quiz1%20SHU%20Solved.ipynb?download=false Page 4 of 5 Quiz1 SHU Solved 19/11/2023, 12:57 AM Write your answer here Asus Task 6: How many laptops have a 4 GB ram? [1 mark] In [36]: df.groupby('RAM_GB')['Price'].nunique() Out[36]: RAM_GB 4 29 6 6 8 155 12 1 16 13 Name: Price, dtype: int64 Write your answer here 29 THE END http://localhost:8888/nbconvert/html/Google%20Drive/My%20Drive/…ta%20analytics/19Nov/Quiz1%20SHU%20Solved.ipynb?download=false Page 5 of 5