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

Question bank_ Python cia 3

The document is a question bank for a Python programming course, covering topics such as NumPy and Pandas. It includes questions on data manipulation, handling missing values, and creating visualizations with Matplotlib. The questions are divided into two parts, focusing on theoretical concepts and practical coding tasks.

Uploaded by

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

Question bank_ Python cia 3

The document is a question bank for a Python programming course, covering topics such as NumPy and Pandas. It includes questions on data manipulation, handling missing values, and creating visualizations with Matplotlib. The questions are divided into two parts, focusing on theoretical concepts and practical coding tasks.

Uploaded by

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

22IT602 – PYTHON PROGRAMMING

QUESTION BANK

PART A

Mention two key differences between NumPy and Pandas.

Define NumPy arrays and explain their primary advantage over Python lists.

How do missing data values affect data analysis, and how can they be handled in Pandas?

Provide an example of sorting a one-dimensional NumPy array in descending order.

List two essential data manipulation functions provided by Pandas.

Develop the python code to read data from a CSV file into a Pandas DataFrame.

Infer the method that you use to fill missing values in a Pandas Series.

Differentiate between groupby and pivot_table.

List two essential data manipulation functions provided by Pandas.


Given a Pandas Data Frame, write a code snippet to filter rows where a column named Score
is greater than 50.

Construct a pivot table using Pandas from a Data Frame containing columns Product, Region,
and Sales.

Given a NumPy array arr = [5, 10, 15, 20, 25], write a code snippet to compute the cumulative
sum.

Differentiate the two methods df.agg() and df.aggregate().


Interpret the process of the merging column in pd.merge.
Develop a function to use to display gridlines in a plot.

Compare and contrast the two methods plt.hist() and plt.bar().

Write a Python code snippet to create a NumPy array of shape (3, 3) containing random
integers between 1 and 10
Demonstrate how to perform an inner join operation on two Pandas Data Frames.

PART B

Demonstrate with examples how NumPy arrays differ from Python lists in terms of
performance, functionality, and memory usage.

Discover the concept of universal functions (ufuncs) in Python with a detailed example.
Discuss the advantages of ufuncs in data processing tasks.

Enumerate the concept of NumPy slicing and indexing. Provide a detailed example to
illustrate how slicing is used to extract and modify specific elements of an array.

Consider a DataFrame named "SKCET_Employee" that contains performance data of


employees from various departments. The columns in the DataFrame are Employee_ID,
Name, Department, Performance_Score, and Salary. Write Python code to implement the
following using pandas:

a) Calculate the average Performance_Score for each department.


b) Replace missing (NaN) values in the Salary column with the average salary of all
employees.
c) Develop a function that adds a new column called Bonus, where employees with a
Performance_Score greater than 85 receive a 10% bonus on their salary.

Filter and display employees who are in the "HR" department and have a Performance_Score
greater than 90.

Illustrate the different methods of handling missing data in Pandas, such as filling and
dropping. Discuss the implications of each method with examples.

Illustrate the importance of handling missing values in a Pandas Series. Explain various
methods for dealing with missing data in Series with a scenario-based example.

Analyze the use of pivot tables in Pandas for summarizing data. Provide an example of
creating a pivot table for sales data and interpreting the results.

You have been provided with data showing population growth in five countries over the past
20 years. The data includes columns for "Year," "Country," and "Population."

1) Develop a Python program to visualize the population growth for each country using
Matplotlib.
2) Use a line plot to show trends for each country over the years, differentiating each
with a unique color and line style.
3) Create an area plot below the line plot to show the cumulative population across all
countries for each year
Add titles, legends, and labels to enhance readability, and adjust the layout for a clean
appearance.

You might also like