0% found this document useful (0 votes)
8 views

Essential Software Assignment 3

Uploaded by

Rayyan Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Essential Software Assignment 3

Uploaded by

Rayyan Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment-03

Instructor: Dr. Muhammad Yousuf Tufail


Essential Software Fall-2024

Instructions:
1. Use the Spyder shell and answer each question separated by #%% taught in the class.
2. Be mindful of the deadline, as late submission and failure to follow the instructions
will lead to
a deduction of the marks.
3. Name the file before submission with your Name and ERP.
4. Make your submission on LMS with a file format .py.

Question 1: Analyzing a Dataset with Customized Functions


1. Download the COVID-19 provided
2. Exploration & Cleaning:
o Check for missing values and handle them appropriately.
o Explore the structure and summary statistics.
3. Customized Functions:
o Create a function to compute basic statistics (mean, median, mode) for
numeric columns.
o Create a function that accepts a column name and a value, and filters the
DataFrame to rows where the column matches the value.
4. Analysis Questions:
o What is the total number of confirmed COVID-19 cases globally to date?
o What is the total number of COVID-19 deaths globally?
o Calculate the global mortality rate (percentage of deaths among confirmed
cases).
o Identify the 5 countries with the highest cumulative cases.
o Identify the 5 countries with the highest cumulative deaths.
o Calculate and display the fatality rate for each WHO region.
5. Visualizations:
o Create a line plot showing the trend of cumulative COVID-19 cases globally
over time.
o Create a bar chart showing the top 5 countries with the highest cumulative
cases
6. Define Python Functions:
o Write functions to calculate metrics:
1. fatality rate
2. mortality rate
7. Prepare a Report:
Summarize your findings with visualizations and insights.

Question 2: Customized Function for Data Transformation


Write a program that uses a customized function to perform the following tasks:
1. Generate a DataFrame containing integers from 1 to 20 and their corresponding
squares and cubes stored in separate columns
2. Print the resulting DataFrame.
3. Save this DataFrame to a CSV file named data_transform.csv.
4. Read the CSV file back into a DataFrame and display its contents.

Question 3: Creating and Manipulating a DataFrame with Dictionaries


1. Construct a DataFrame using a dictionary containing information about five
individuals (First Name, Last Name, Age, and CGPA).
2. Perform the following:
o Print the DataFrame.
o Create a customized function to calculate the average CGPA.
o Save the DataFrame to a CSV file named student_data.csv.
o Read the CSV file back and print it.

You might also like