MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Course Title: Data Science Course Code: 2290501
Assignment-5
Exploratory Data Analysis (Unit 3 Part 1)
Instruction:
● Write Python code.
● Write 2 sets of code, 1 for own created data (if applicable) and 1 for any
imported dataset. That is, total 10 questions.
Question 1. Handling Missing Data:
Describe three common methods for dealing with missing data in a pandas
DataFrame. Provide an example of when you might use each method. Provide code
to demonstrate.
Question 2. Data Transformation: Removing Duplicates:
Explain the purpose of removing duplicate rows from a DataFrame. How can you
identify and remove duplicate rows in pandas? Provide code to demonstrate.
Question 3. Transforming Data Using a Function or Mapping:
Suppose you have a DataFrame with a column containing dates in the format
'yyyy-mm-dd'. Create a custom function that extracts the year from each date and
applies it to a new column. Provide code to demonstrate.
Dr. Rohit Agrawal
MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Question 4. Replacing Values:
In a given DataFrame, you have a column containing numerical values, and you
want to replace all instances of 0 with the mean of the non-zero values in that
column. How would you achieve this using pandas? Provide code to demonstrate.
Question 5. Detecting and Filtering Outliers:
Explain the concept of outliers in data analysis.
Using a real or hypothetical dataset, outline the steps to detect and filter out
outliers in a pandas DataFrame. Provide code to demonstrate.
Dr. Rohit Agrawal