Question

Write a Python program with suitable comments using pandas that performs the following tasks after
reading the file.
 identify missing values,
 remove duplicate records,
 replace inconsistent values,
 fill missing salary values using an appropriate method, and
 rename the column headings.
(d) Explain different techniques used for handling missing data. Discuss situations where each technique is
appropriate. (3 Marks)
8
(e) A dataset contains the ages of 500 customers ranging from 18 to 80 years. Explain different ways to
classify these customers into age groups using discretisation (binning). (4 Marks)
(f) Write Python code to detect outliers using the interquartile range method. Also, explain the strategies for
handling outliers in data with the help of suitable examples. (4 Marks)
Q2:
(a) Two data files contain customer details and purchase details having the same format. These files may
contain overlapped data. Write and explain the Python program to merge the two files. Make and state
assumptions, if any (3 Marks)
(b) Explain hierarchical indexing. Illustrate how hierarchical indexing can be used for reshaping datasets
with suitable examples. (3 Marks)
(c) A supermarket dataset contains the following fields: (3 Marks)
 Region
 Product Category
 Sales
 Profit
Write a Python program to perform the following tasks:
 group data by Region,
 calculate total sales,
 calculate average profit.
(d) Why is the need to create groups during data analysis? Explain with the help of an example. Explain the
working of the groupby() function in pandas. Discuss grouping using dictionaries, functions and Series
in Python with suitable examples. 
(e) Make a synthetic dataset containing monthly sales of three different products for one year. Write a
Python program using Matplotlib and/or Seaborn to generate a line plot and a scatter plot. Make suitable
assumptions. 
(f) Write a Python code to demonstrate the purpose of figures, axes, labels, legends, annotations and subplot
arrangements with suitable examples.
 

 

30 Jul 2026
Answer :
Word Count : 874
Data wrangling is the process of cleaning, transforming, and organizing raw data into a suitable format for analysis and visualization. Python's pandas library provides efficient functions for handling missing values, duplicates, inconsistent entries, and data transformation. ```python # Import pandas import pandas as pd # Read the CSV file df = pd.read_csv("employee_data.csv") # Display missing values in each column print("Missing Values:") print(df.isnull().sum()) # Remove duplicate records df = df.drop_duplicates() # Replace inconsistent values in Gender column df["Gender"] = df["Gender"].replace({ "M": "Male", "F": "Female", "male": "Male", "female": "Female" }) # Fill missing salary values with median salary df["Salary"] = df["Salary"].fillna(df["Salary"].median()) # Rename column headings df = df.rename(columns={ "EmpID": "Employee_ID", "EmpName": "Employee_Name", "Dept": "Department", "Salary": "Monthly_Salary" }) print(df.head()) ``` Missing data handling techniques are essential because incomplete data may reduce the accuracy of analysis. Deletion methods include listwise deletion, where rows containing missing values are removed. This method is appropriate when only a small percentage of records is missing and sufficient data remain. Pairwise deletion removes only missing values needed for a particular analysis and is useful in correlation analysis. Mean, median, or mode imputation replaces missing values with statistical measures. Mean is suitable for normally distributed numerical data, median for skewed data such as salaries, and mode for categorical attributes. Forward fill and backward fill methods are appropriate for time-series datasets where nearby observations are related. Interpolation estimates missing values based on surrounding observations and is commonly
____ ___ ________ ________ ___ _________ _________ _______ _____.
____ _______ _____ _______ _________ ________ ________ ______ _________ __________ ____ ________.
___ _________ __________ ____ _________ _________ ___ __________ ________.
____ ______ _____ _______ ______ ___ _______ ___ ___ __________ ________.
_____ ________ ___ _______ ____ ________ _______.
______ ____ _________ ___ _________ ___ ____ ________ _______.
______ _____ ____ ___ ______ ______ ____ __________ _____ ______.
___ ________ __________ ______ __________.
_____ ______ ____ _______ ________ ____ ____ ________ ______ _____.
________ _____ _____ ________ ___ __________ _________ ____ __________ _______.
________ ______ _____ __________ ______ _________ __________ _________ ________.
______ ___ ________ ______ _________ _________ __________ ______.
_________ __________ _____ ____ ___ _____ ___ _________ __________.
______ ___ ________ _________ ____ ________.
_________ _____ _________ _________ __________ ________ ____ _______ _______.
__________ ______ _________ ____ ______ ____ _____ _____.
_____ ______ _____ ________ _______ ______ _________ _________ ______ ___.
_______ _____ ________ ______ __________ __________ ______ _____ _______ ___ __________ ____.
_______ __________ ______ ________ ________ __________ ________.
____ _____ _______ _________ ___ ____ ______ ________ _________.
_____ _______ ___ _____ ______.
__________ ________ _______ ___ __________ __________ _______ ___ _________ ____.
______ ______ _________ ______ _______ __________ _____ ________.
_____ ___ _________ ______ ______.
____ ________ _________ ____ ____ ____ ______ ___ ______ ______.
_________ ____ ___ _____ ____ ___ __________ ___ _________.
__________ ____ _________ _____ __________ __________ _______ ________.
______ _________ ________ ____ ______ __________ ______ __________ _________.
____ ______ _______ ________ ________ ___ ______ ______.
_______ __________ _________ _________ _________ ___ ___ ____ ___.
_______ _______ ____ _____ _______ ____ ________ _______ _______ ________.
___ _____ ____ ____ __________ _________ _________ _________.
_______ __________ ________ _____ ___ _____ ________ _____.
_______ ____ ____ __________ __________ _________.
________ __________ __________ ______ ______ _________ _______ _____ ________ ____.
__________ __________ ________ _____ __________ ______ _____ _____ ____ ___ __________.
_______ ______ ______ ________ ________.
____ ____ _____ ___ _______ ___ ____ ____ ______ __________ _________ ____.
______ __________ ______ _________ ________ ________ ________ _________ __________.
___ ______ _______ ___ ________ ______ _________ __________ ________ ________ ________.
_________ __________ ___ ___ ______ ________ _________ ________ _____ _____.
______ _________ ____ _________ _____ ___.
____ ____ _________ __________ _______ ________ ______ _____ ___ _________ _______ _________.
__________ ___ ______ ___ _____ ____ ____ __________.
_______ __________ ____ __________ ________ _________ ________.
______ ________ _________ ________ _____ _____ ___ _________ _____ __________.
__________ __________ ___ __________ ___ __________ _______.
____ ___ _________ ___ ______ __________.
_________ ________ __________ _____ _____ _______.
________ _________ ________ ______ _____ ____ ___.
__________ _______ _____ ________ _________ _______ _________ _________ _______ _________ ________.
_____ _____ _____ ___ _____ ________ ________.
______ _____ ___ ___ ___ ____ ________ ___ ________.
________ ___ _______ _________ ________ _____ ____ ____ __________.
_______ _______ _________ _________ __________ ____ __________ ______ ________ ______.
________ _______ __________ ___ _____ ____ _______ ________ _______.
____ ___ ____ ________ ________ ____ _______ _________ ____ _______ _______.
________ ______ __________ ________ ________ _________ ________ __________ __________ ___.
_________ ___ ______ _______ ______ _____ _________ ______ ______.
______ _______ _________ ____ ___ ____ _________ ____.
___ ______ _________ ______ _____ ____ _______ _________ ___ ____ _________.
__________ ____ ___ ____ _____.
__________ ________ _____ _______ ___ __________.
___ __________ __________ ____ ____ ___ ____ _________.
___ _____ ______ _____ __________ __________ _________ ___.
_____ __________ ____ ______ ______ __________ _________ ________ _____ ____.
__________ _______ ________ ______ __________ ____ ___ ____ ________ ___ __________ _________.
________ __________ _________ __________ ______ _________.
________ ___ __________ _____ ________.
_________ _______ ________ ____ _________ ___ _______ _________ ___ _________.
_______ ___ ___ __________ __________ __________ _________ ___.
______ ____ ____ ________ ______.
____ _____ _____ ____ _______ ________.
_______ ________ ____ __________ _________.
________ ______ ________ _______ _______ ________ __________ _______ _____ _______.
____.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 67 2026 2027 - Write a Python program with suitable comments using pandas that perfor | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→