Board Q&A · Class 12 Informatics Practices

Data Handling Using Pandas (Series and DataFrame): Class 12 CBSE Previous-Year Questions with Answers

CBSE Question Papers →

81 questions from CBSE board, sample and compartment papers (2024–2027), 1 to 5 marks, each with a model answer. Questions on creating Series and DataFrames from lists, dictionaries, NumPy arrays and scalar values, indexing and slicing with loc and iloc, head() and tail(), adding, renaming and deleting rows and columns, finding the output of Pandas code and correcting errors in it. Programming answers open in the Python Lab.

Showing 81 of 292 questions
Group

Data Handling Using Pandas – I

81 Questions
Data Handling Using Pandas – I· 1 Mark· Q10· 2024 Board Paper Python
What will be the output of the following Python code? import pandas as pd dd = {'One': 1, 'Two': 2, 'Three': 3, 'Seven': 7} rr = pd.Series(dd) rr['Four'] = 4 print(rr)
  1. (A)(i) One 1 Two 2 Three 3 Seven 7 dtype: int64
  2. (B)(ii) One 1 Two 2 Three 3 Four 4 Seven 7 dtype: int64
  3. (C)(iii) Four 4 One 1 Two 2 Three 3 Seven 7 dtype: int64
  4. (D)(iv) One 1 Two 2 Three 3 Seven 7 Four 4 dtype: int64
Data Handling Using Pandas – I· 1 Mark· Q12· 2024 Board Paper
Which of the following command will not show first five rows from the Pandas series named S1?
  1. (A)(i) S1[0:5]
  2. (B)(ii) S1.head()
  3. (C)(iii) S1.head(5)
  4. (D)(iv) S1.head[0:5]
Data Handling Using Pandas – I· 1 Mark· Q18· 2024 Board Paper
Assertion (A) : A Series is a one dimensional array and a DataFrame is a two-dimensional array containing sequence of values of any data type. (int, float, list, string, etc.) Reason (R) : Both Series and DataFrames have by default numeric indexes starting from zero.
  1. (A)(i) Both (A) and (R) are true and (R) is the correct explanation for (A).
  2. (B)(ii) Both (A) and (R) are true and (R) is not the correct explanation for (A).
  3. (C)(iii) (A) is true and (R) is false.
  4. (D)(iv) (A) is false but (R) is true.
Data Handling Using Pandas – I· 2 Marks· Q20· 2024 Board Paper Python
The Python code written below has syntactical errors. Rewrite the correct code and underline the correction(s) made. import Pandas as pd stud=['Name' : 'Ramya', 'Class' : 11, 'House' : 'Red'] s=p.Series(s) print(s)
Data Handling Using Pandas – I· 2 Marks· Q22· 2024 Board Paper Python
Find the output of the following Python code : import pandas as pd com = pd.Series([45, 12, 15, 200], index=['mouse', 'printer', 'webcam', 'keyboard']) print(com[1:3])
Data Handling Using Pandas – I· 2 Marks· Q24· 2024 Board Paper Python
Consider the following Python code : import pandas as pd S1 = pd.Series(['Rubina', 'Jaya', 'Vaibhav'], index=[10, 16, 18]) S2 = pd.Series(_________, index=[10, 16, 18]) S3 = pd.Series([56, 67, 86], _________) xiia = {'Name': _________, 'Subject': S2, 'Marks': S3} df = pd.DataFrame(_________) print(df) Complete the above Python code to display the following output : Name Subject Marks 10 Rubina IP 56 16 Jaya HSc 67 18 Vaibhav IP 86
Data Handling Using Pandas – I· 3 Marks· Q27· 2024 Board Paper Python
Kabir, a data analyst, has stored the voter's name and age in a dictionary. Now, Kabir wants to create a list of dictionaries to store data of multiple voters. He also wants to create a DataFrame from the same list of dictionaries having appropriate row labels as shown below: Voter_Name Voter_Age Ar1001 Arjun 35 Ba3002 Bala 23 Go4002 Govind 25 Dh4007 Dhruv 19 Na6005 Navya 18 Help Kabir in writing a Python program to complete the task.
Data Handling Using Pandas – I· 3 Marks· Q30· 2024 Board Paper Python
Consider the given DataFrame 'password': CodeName Category Frequency 0 aaaaaa alpha 6.91 1 dragon animal 18.52 2 baseball sport 1.29 3 football sport 11.11 4 monkey animal 3.72 5 qwerty alpha 1.85 6 abcde alpha 3.19 Write suitable Python statements for the following: (i) To add a new row with following values: CodeName – 'abc123' Category – 'alphanumeric' Frequency – 12.8 (ii) To delete the row with the row label 2. (iii) To delete the column having column label as Frequency.
Data Handling Using Pandas – I· 4 Marks· Q32· 2024 Board Paper Python
Ms. Ritika conducted an online assessment and stored the details in a DataFrame result as given below: Name Score Attempts Qualify a Atulya 12.5 1 yes b Disha 9.0 3 no c Kavita 16.5 2 yes d John 15.0 1 no Answer the following questions : (i) Predict the output of the following Python statement: print(result.loc[:, 'Attempts'] > 1) (ii) Write python statement to display the last three records. (iii) Write Python statement to display records of 'a' and 'd' row labels. OR (Option for Part (iii) only) (iii) Write suitable Python statement to retrieve the data stored in the file, 'registration.csv' into a DataFrame, 'regis'.
Data Handling Using Pandas – I· 1 Mark· Q1· 2025 Board Paper
State whether the following statement is True or False: In Python, we cannot create an empty DataFrame.
Data Handling Using Pandas – I· 1 Mark· Q6· 2025 Board Paper
What is the default index type for a Pandas Series if not explicitly specified?
  1. (A)String
  2. (B)List
  3. (C)Numeric
  4. (D)Boolean
Data Handling Using Pandas – I· 1 Mark· Q9· 2025 Board Paper
Which of the following data structure is used for storing one-dimensional labelled data in Python Pandas?
  1. (A)Integer
  2. (B)Dictionary
  3. (C)Series
  4. (D)DataFrame
Data Handling Using Pandas – I· 1 Mark· Q13· 2025 Board Paper Python
Which of the following Python statements will be used to select a specific element having index as points, from a Pandas Series named ser?
  1. (A)ser.element(points)
  2. (B)ser.select (points)
  3. (C)ser[points]
  4. (D)ser.show[points]
Data Handling Using Pandas – I· 1 Mark· Q15· 2025 Board Paper
Which of the following libraries defines an ndarray in Python?
  1. (A)pandas
  2. (B)numpy
  3. (C)matplotlib
  4. (D)scipy
Data Handling Using Pandas – I· 1 Mark· Q17· 2025 Board Paper Python
Which of the following Python statements is used to change a column label in a DataFrame, df?
  1. (A)df = df.rename({old_name : new_name}, axis='columns')
  2. (B)df = df.rename(old_name, new_name), axis='columns'
  3. (C)df = df.change_name(old_name, new_name, axis='bar')
  4. (D)df = df.update({old_name : new_name}, axis='bar')
Data Handling Using Pandas – I· 1 Mark· Q18· 2025 Board Paper
In Python Pandas, DataFrame. ______ [] is used for label indexing with DataFrames.
  1. (A)label
  2. (B)index
  3. (C)labindex
  4. (D)loc
Data Handling Using Pandas – I· 1 Mark· Q20· 2025 Board Paper
Assertion (A): The drop() method in Pandas can be used to delete rows and columns from a DataFrame. Reason (R): The axis parameter in the drop() method specifies whether to delete rows (axis=0) or columns (axis=1).
  1. (A)Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
  2. (B)Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
  3. (C)Assertion (A) is True and Reason (R) is False.
  4. (D)Assertion (A) is False, but Reason (R) is True.
Data Handling Using Pandas – I· 2 Marks· Q22· 2025 Board Paper
(a) Mention any two main points of difference between Series and DataFrame of Python Pandas. OR (b) Explain how we can access elements of a series using slicing. Give an example to support your answer.
Data Handling Using Pandas – I· 2 Marks· Q28· 2025 Board Paper Python
(a) Rohit is trying to create a Pandas Series from scalar values. His code has some mistakes. Rewrite the correct code and underline the corrections made. import pandas data = [50, 15, 40] series = pd.series(data, Index=['x', 'y', 'z']) Print(series) OR (b) Complete the given Python code to generate the following output: | COLOUR | NAME | QTY 0 | Red | Apple | 10 1 | Blue | Berry | 15 2 | Green | Guava | 20 import ________ as pd data=[{'COLOUR':'Red','NAME':'Apple', 'QTY':10}, {'COLOUR':'Blue','NAME':'Berry', 'QTY':15}, {________,'NAME' :'Guava','QTY':20}] df=pd.DataFrame(________) print(________)
Data Handling Using Pandas – I· 3 Marks· Q30· 2025 Board Paper Python
(a) Write a Python program to create the following DataFrame using a Dictionary of Series: | City | State 0 | Mumbai | Maharashtra 1 | Dehradun | Uttarakhand 2 | Bengaluru | Karnataka 3 | Hyderabad | Telangana OR (b) Write a Python program to create a Pandas Series as shown below from an ndarray containing the numbers 10, 20, 30, 40, 50 with corresponding indices 'A', 'B', 'C', 'D', 'E'. A | 10 B | 20 C | 30 D | 40 E | 50
Data Handling Using Pandas – I· 5 Marks· Q36· 2025 Board Paper Python
Consider the DataFrame Doctor shown below: | DID | Name | Department | Fee 0 | 101 | Dr. Joe | ENT | 1500 1 | 102 | Dr. Salma | UROLOGY | 1600 2 | 103 | Dr. Jeet | ORTHO | 1550 3 | 104 | Dr. Neha | ENT | 1200 4 | 105 | Dr. Vikram | ORTHO | 1700 Write suitable Python statements for the following: (i) To print the last three rows of the DataFrame Doctor. (ii) To display the names of all doctors. (iii) To add a new column 'Discount' with value of 200 for all doctors. (iv) To display rows with index 2 and 3. (v) To delete the column 'Department'.
Data Handling Using Pandas – I· 1 Mark· Q1· 2026 Board Paper
State whether the following statement is True or False: In Pandas Series, the Positional index can be a string or an integer.
Data Handling Using Pandas – I· 1 Mark· Q2· 2026 Board Paper
We can add a new row to a DataFrame DF using the _______ method.
  1. (A)DF.add()
  2. (B)DF.loc[]
  3. (C)DF.loc()
  4. (D)DF.addloc[]
Data Handling Using Pandas – I· 1 Mark· Q8· 2026 Board Paper Python
Aditya is working on a DataFrame named df. He has written the statement: print(df.loc['S2']) What will the above statement do?
  1. (A)Display the data of the row having label 'S2'.
  2. (B)Display the columns of the DataFrame.
  3. (C)Display the data type of the column having label 'S2'.
  4. (D)Display the index numbers of the DataFrame.
Data Handling Using Pandas – I· 1 Mark· Q14· 2026 Board Paper
In the context of creating a Pandas Series from a dictionary, which of the following statement is correct?
  1. (A)The values of the dictionary become the indices of the Series.
  2. (B)The keys of the dictionary become the values of the Series.
  3. (C)The keys of the dictionary become the indices of the Series.
  4. (D)The Series will have default integer indices starting from 0, ignoring the dictionary keys.
Data Handling Using Pandas – I· 1 Mark· Q15· 2026 Board Paper
In Pandas, when extracting a portion of a Series ser1 using ser1[start:end] with positional indices start and end, which of the following statements is true?
  1. (A)The element at the end index is included in the output.
  2. (B)The element at the end index is excluded from the output.
  3. (C)The elements at both the start and end indices are excluded from the output.
  4. (D)The element at the start index is excluded from the output.
Data Handling Using Pandas – I· 1 Mark· Q18· 2026 Board Paper
In a Pandas DataFrame, which value for axis will be used to delete a column?
  1. (A)axis = -1
  2. (B)axis = 0
  3. (C)axis = 1
  4. (D)axis = 2
Data Handling Using Pandas – I· 1 Mark· Q20· 2026 Board Paper
Assertion (A): Pandas DataFrame can store values of multiple data types in multiple Columns. Reason (R): DataFrames are implemented using 2D arrays, which allows only numeric values.
Data Handling Using Pandas – I· 2 Marks· Q22· 2026 Board Paper Python
(a) List any two characteristics of Pandas library in Python. OR (b) Briefly explain the purpose of Boolean Indexing with respect to DataFrames. Support your answer with a suitable example.
Data Handling Using Pandas – I· 2 Marks· Q28· 2026 Board Paper Python
(a) Niharika wants to create a Pandas Series using a NumPy array with three elements 'a', 'b', and 'c', and assign custom indexes 'first', 'second' and 'third'. Help her complete the code below. import pandas as pd import ______ as np arr = np._____ (['a' , 'b' , 'c']) s = pd._____(arr,_____=['first','second','third']) print(s) OR (b) Write the output of the following code: import pandas as pd s1 = pd.Series ([1, 2, 3], index = ['a','b','c']) s2 = pd.Series ([4, 5, 6], index = ['b','c','d']) print (s1 + s2)
Data Handling Using Pandas – I· 3 Marks· Q30· 2026 Board Paper Python
(a) Write a Python program to create and display a Pandas Series as shown below: July 31 Aug 31 Sept 30 Oct 31 The index labels are the names of the months - July, Aug, Sept, Oct. The corresponding scalar values are the number of days in these respective months - 31, 31, 30, 31. OR (b) A CSV file named customer.csv contains records of customers. The first row of the file represents the header. Sample data from the file is shown below: Name, Age, City Rudra,17,Kolkata Divya,19,Dehradun Nabeel,22,Lucknow Write a Python program to import data from the CSV file into a Pandas DataFrame named DF and display the last two rows.
Data Handling Using Pandas – I· 5 Marks· Q36· 2026 Board Paper Python
Consider the DataFrame 'Scholarship'. Answer the following: I. Write Python code to create and display the given DataFrame using the Dictionary of Series method. II. Rename row indexes to ['a', 'b', 'c', 'd', 'e']. III. Write a Python statement to remove the last row of the given DataFrame.
Data Handling Using Pandas – I· 1 Mark· Q1· 2025 Compartment Paper
State whether the following statement is True or False: "Series data structure of Pandas can hold the value of integer data type only."
Data Handling Using Pandas – I· 1 Mark· Q6· 2025 Compartment Paper
Which of the following functions is used to delete a row from a DataFrame?
  1. (A)drop()
  2. (B)delete()
  3. (C)remove_row()
  4. (D)pop_attribute()
Data Handling Using Pandas – I· 1 Mark· Q7· 2025 Compartment Paper
_____ is the type of indexing that allows us to filter a DataFrame by applying a condition. (Label Indexing / Boolean Indexing)
Data Handling Using Pandas – I· 1 Mark· Q13· 2025 Compartment Paper
NumPy stands for _____ Python.
  1. (A)Numerous
  2. (B)Neural
  3. (C)Numerical
  4. (D)Numron
Data Handling Using Pandas – I· 1 Mark· Q15· 2025 Compartment Paper Python
To create a Pandas series from an ndarray 'array1', which of the following statements can be used? (Note: Assume pd as alias for pandas)
  1. (A)pd.array(array1)
  2. (B)nd.series(array1)
  3. (C)pd.Series(array1)
  4. (D)array1.toSeries()
Data Handling Using Pandas – I· 1 Mark· Q18· 2025 Compartment Paper Python
How can we add a new column named 'name' to a DataFrame 'dF'? (Note: Assume the values for the column are stored in a list named 'data')
  1. (A)dF.add_column(name, data)
  2. (B)dF['name'] = data
  3. (C)dF.set_column(name, data)
  4. (D)dF.add(name, data)
Data Handling Using Pandas – I· 1 Mark· Q20· 2025 Compartment Paper
Assertion (A): Pandas is a high level data manipulation tool used for analyzing data. Reason (R): It is very easy to import and export data using the Pandas library which has a very rich set of functions.
Data Handling Using Pandas – I· 2 Marks· Q22· 2025 Compartment Paper
(a) What is DataFrame in Pandas? Explain with the help of an example. OR (b) What is data visualization? Also mention its any one main purpose.
Data Handling Using Pandas – I· 3 Marks· Q30· 2025 Compartment Paper Python
(a) Write a Python Program to create a DataFrame using a list of dictionaries with the following data: Student | Marks 0 | Aarav | 85 1 | Aisha | 90 2 | Vivaan | 78 3 | Meera | 92 OR (b) Write a Python program to create a Pandas Series from a scalar value. The Series should have indexes as 'X1', 'X2', 'X3', 'X4', 'X5' with each value in the Series set to 100.
Data Handling Using Pandas – I· 5 Marks· Q36· 2025 Compartment Paper Python
Consider the DataFrame dF shown below: PRODUCT_ID | PRODUCT_NAME | CATEGORY | PRICE P001 | Laptop | Electronics | 60000 ... Write Python statements for the DataFrame dF to: (i) Print the first row of the DataFrame dF. (ii) Display the 'PRODUCT_NAME' column for all products. (iii) Add a new row with the following values: [5, 'P006', 'AC', 'HOME', 80000] (iv) Remove the column 'CATEGORY'. (v) Rename the column 'PRODUCT_NAME' to 'Item'.
Data Handling Using Pandas – I· 1 Mark· Q10· 2024 Sample Paper
Which of the following command will show the last 3 rows from a Pandas Series named NP?
  1. (A)i. NP.Tail( )
  2. (B)ii. NP.tail(3)
  3. (C)iii. NP.TAIL(3)
  4. (D)iv. All of the above
Data Handling Using Pandas – I· 1 Mark· Q12· 2024 Sample Paper
In Python Pandas, while performing mathematical operations on series, index matching is implemented and all missing values are filled in with _____by default.
  1. (A)i. Null
  2. (B)ii. Blank
  3. (C)iii. NaN
  4. (D)iv. Zero
Data Handling Using Pandas – I· 1 Mark· Q18· 2024 Sample Paper
Assertion (A):- To use the Pandas library in a Python program, one must import it. Reasoning (R): - The only alias name that can be used with the Pandas library is pd.
  1. (A)i. Both A and R are true and R is the correct explanation for A
  2. (B)ii. Both A and R are true and R is not the correct explanation for A
  3. (C)iii. A is True but R is False
  4. (D)iv. A is false but R is True
Data Handling Using Pandas – I· 2 Marks· Q20· 2024 Sample Paper Python
The python code written below has syntactical errors. Rewrite the correct code and underline the corrections made. Import pandas as pd df ={"Technology":["Programming","Robotics","3D Printing"],"Time(in months)":[4,4,3]} df= Pd.dataframe(df) Print(df)
Data Handling Using Pandas – I· 2 Marks· Q22· 2024 Sample Paper Python
Predict the output of the given Python code: import pandas as pd list1=[-10,-20,-30] ser = pd.Series(list1*2) print(ser)
Data Handling Using Pandas – I· 2 Marks· Q24· 2024 Sample Paper Python
Complete the given Python code to get the required output as: Rajasthan import _________ as pd di = {'Corbett': 'Uttarakhand', 'Sariska': 'Rajasthan', 'Kanha': 'Madhya Pradesh', 'Gir':'Gujarat'} NP = ___________. Series( _____ ) print(NP[ ___________ ])
Data Handling Using Pandas – I· 3 Marks· Q27· 2024 Sample Paper Python
Create a DataFrame in Python from the given list: [[‘Divya’,’HR’,95000],[‘Mamta’,’Marketing’,97000],[‘Payal’,’IT’,980000], [‘Deepak’,’Sales’,79000]] Also give appropriate column headings as shown below: Name Department Salary 0 Divya HR 95000 1 Mamta Marketing 97000 2 Payal IT 980000 3 Deepak Sales 79000
Data Handling Using Pandas – I· 3 Marks· Q30· 2024 Sample Paper Python
Consider the given DataFrame ‘Genre’: Type Code 0 Fiction F 1 Non Fiction NF 2 Drama D 3 Poetry P Write suitable Python statements for the following: i. Add a column called Num_Copies with the following data: [300,290,450,760]. ii. Add a new genre of type ‘Folk Tale' having code as “FT” and 600 number of copies. iii. Rename the column ‘Code’ to ‘Book_Code’.
Data Handling Using Pandas – I· 4 Marks· Q32· 2024 Sample Paper Python
Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that contains the four quarter’s sales data of different stores as shown below: Store Qtr1 Qtr2 Qtr3 Qtr4 0 Store1 300 240 450 230 1 Store2 350 340 403 210 2 Store3 250 180 145 160 Answer the following questions: i. Predict the output of the following python statement: a. print(df.size) b. print(df[1:3]) ii. Delete the last row from the DataFrame. iii. Write Python statement to add a new column Total_Sales which is the addition of all the 4 quarter sales. OR (Option for part iii only) Write Python statement to export the DataFrame to a CSV file named data.csv stored at D: drive.
Data Handling Using Pandas – I· 1 Mark· Q1· 2025 Sample Paper
State whether the following statement is True or False: Slicing can be used to extract a specific portion from a Pandas Series.
Data Handling Using Pandas – I· 1 Mark· Q6· 2025 Sample Paper Python
Which of the following Python statements can be used to select a column column_name from a DataFrame df ?
  1. (A)df.getcolumn('column_name')
  2. (B)df['column_name']
  3. (C)df.select('column_name')
  4. (D)df(column_name)
Data Handling Using Pandas – I· 1 Mark· Q13· 2025 Sample Paper
In a Pandas DataFrame, if the tail() function is used without specifying the optional argument indicating the number of rows to display, what is the default number of rows displayed, considering the DataFrame has 10 entries?
  1. (A)0
  2. (B)1
  3. (C)4
  4. (D)5
Data Handling Using Pandas – I· 1 Mark· Q15· 2025 Sample Paper Python
While creating a Series using a dictionary, the keys of the dictionary become:
  1. (A)Values of the Series
  2. (B)Indices of the Series
  3. (C)Data type of the Series
  4. (D)Name of the Series
Data Handling Using Pandas – I· 1 Mark· Q17· 2025 Sample Paper
Fill in the Blank Boolean indexing in Pandas DataFrame can be used for _______.
  1. (A)Creating a new DataFrame
  2. (B)Sorting data based on index labels
  3. (C)Joining data using labels
  4. (D)Filtering data based on condition
Data Handling Using Pandas – I· 1 Mark· Q20· 2025 Sample Paper
Assertion (A): We can add a new column in an existing DataFrame. Reason (R): DataFrames are size mutable.
  1. (A)Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A)
  2. (B)Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A)
  3. (C)Assertion (A) is True, but Reason (R) is False
  4. (D)Assertion (A) is False, but Reason (R) is True
Data Handling Using Pandas – I· 2 Marks· Q22· 2025 Sample Paper
(A) What is a Series in Python Pandas? Also, give a suitable example to support your answer. OR (B) What does the term 'library' signify in Python? Mention one use for each of the following libraries: • Pandas • Matplotlib
Data Handling Using Pandas – I· 2 Marks· Q28· 2025 Sample Paper Python
(A) Sneha is writing a Python program to create a DataFrame using a list of dictionaries. However, her code contains some mistakes. Identify the errors, rewrite the correct code, and underline the corrections made. import Pandas as pd D1 = {'Name': 'Rakshit', 'Age': 25} D2 = {'Name': 'Paul', 'Age': 30} D3 = {'Name': 'Ayesha", 'Age': 28} data = [D1,D2,D3) df = pd.Dataframe(data) print(df) OR (B) Complete the given Python code to get the required output (ignore the dtype attribute). Output: Tamil Nadu Chennai Uttar Pradesh Lucknow Manipur Imphal Code: import _______ as pd data = ['Chennai','_______','Imphal'] indx = ['Tamil Nadu','Uttar Pradesh','Manipur'] s = pd.Series(_______, indx) print(_______)
Data Handling Using Pandas – I· 3 Marks· Q30· 2025 Sample Paper Python
(A) Write a Python program to create the following DataFrame using a list of dictionaries. | Product | Price 0 | Laptop | 60000 1 | Desktop | 45000 2 | Monitor | 15000 3 | Tablet | 30000 OR (B) Write a Python Program to create a Pandas Series as shown below using a dictionary. Note that the left column indicates the indices and the right column displays the data. Russia | Moscow Hungary | Budapest Switzerland | Bern
Data Handling Using Pandas – I· 5 Marks· Q36· 2025 Sample Paper Python
Consider the DataFrame df shown below. MovieID Title | Year | Rating 0 | 1 | LAGAAN | 2001 | 8.4 1 | 2 | TAARE ZAMEEN PAR | 2007 | 8.5 2 | 3 | 3 IDIOTS | 2009 | 8.4 3 | 4 | DANGAL | 2016 | 8.4 4 | 5 | ANDHADHUN | 2018 | 8.3 Write Python statements for the DataFrame df to: I. Print the first two rows of the DataFrame df. II. Display titles of all the movies. III. Remove the column rating. IV. Display the data of the 'Title' column from indexes 2 to 4 (both included) V. Rename the column name 'Title' to 'Name'.
Data Handling Using Pandas – I· 1 Mark· Q1· 2026 Sample Paper
State whether the following statement is True or False: The drop() method can be used to remove rows or columns from a Pandas DataFrame.
Data Handling Using Pandas – I· 1 Mark· Q8· 2026 Sample Paper
The default index used in a Pandas Series, if no index is explicitly specified, is _____
  1. (A)Strings starting with 'a'
  2. (B)Consecutive integers starting from
  3. (C)Random integers
  4. (D)Consecutive integers starting from 0
Data Handling Using Pandas – I· 1 Mark· Q12· 2026 Sample Paper
When two Pandas Series with different indices are added, the result is _____.
  1. (A)Error occurs
  2. (B)Indices are ignored, and elements are added in order
  3. (C)The result has all indices, with missing values filled as NaN
  4. (D)Only the common indices are retained in the result
Data Handling Using Pandas – I· 1 Mark· Q15· 2026 Sample Paper
Which of the following Python commands selects the first 3 rows of a DataFrame df, assuming that labelled index are consecutive integers starting from 0?
  1. (A)df.loc[:3]
  2. (B)df.loc[:2]
  3. (C)df.loc[0:4]
  4. (D)df.loc[1:4]
Data Handling Using Pandas – I· 1 Mark· Q18· 2026 Sample Paper Python
Which of the following Python statements creates an empty Pandas DataFrame (Note: pd is an alias for pandas)?
  1. (A)pd.DataFrame(None)
  2. (B)pd.DataFrame()
  3. (C)pd.DataFrame([])
  4. (D)pd.DataFrame.empty()
Data Handling Using Pandas – I· 1 Mark· Q20· 2026 Sample Paper
Assertion (A):. The output of print(df) and print(df.loc[:]) will be same for a DataFrame df. Reason (R): The statement print(df.loc[:]) will display all rows and columns of the DataFrame df, thus showing the entire data.
  1. (A)Both A and R are True, and R correctly explains A.
  2. (B)Both A and R are True, but R does not correctly explain A.
  3. (C)A is True, but R is False.
  4. (D)A is False, but R is True.
Data Handling Using Pandas – I· 2 Marks· Q22· 2026 Sample Paper
(A) What is a DataFrame in Pandas? Mention any one property of DataFrame. OR (B) List any two differences between Series and DataFrame in Pandas.
Data Handling Using Pandas – I· 2 Marks· Q24· 2026 Sample Paper Python
Ravi wants to create a Pandas Series as shown below: January | 31 February | 28 March | 31 Help him in completing the code below to achieve the desired output. Note: ser_data is a dictionary. import _____ as pd ser_data = _____ s = pd._____(ser_data) print(s)
Data Handling Using Pandas – I· 2 Marks· Q28· 2026 Sample Paper Python
(A) Write the output of the following code: import pandas as pd students = pd.Series(['Abhay', 'Ananya', 'Javed']) marks = pd.Series([85, 92, 88]) data = {'Name': students, 'Marks': marks} df = pd.DataFrame(data) df.rename(columns={'Name': 'StuName', 'Marks': 'Score'}, inplace=True) print(df) OR (B) Write the output of the following code: import pandas as pd states = pd.Series(['Maharashtra', 'Gujarat', 'Kerala']) capitals = pd.Series(['Mumbai', 'Gandhinagar', 'Thiruvananthapuram']) data = {'State': states, 'Capital': capitals} df = pd.DataFrame(data) df.drop(index=1, inplace=True) print(df)
Data Handling Using Pandas – I· 3 Marks· Q30· 2026 Sample Paper Python
(A) Write a Python program to create a Pandas Series as shown below using a ndarray, where the subject names are the indices and the corresponding marks are the values in the series. Mathematics | 85 Science | 90 English | 78 History | 88 OR (B) Write a Python program to create the Pandas DataFrame displayed below using a list of dictionaries. | Course | Duration 0 | Data Science | 12 1 | Artificial Intelligence | 18 2 | Web Development | 6
Data Handling Using Pandas – I· 5 Marks· Q36· 2026 Sample Paper Python
Consider the DataFrame df shown below. | Name | Department | Salary 0 | Rohan Sharma | IT | 75000 1 | Meera Kapoor | HR | 68000 2 | Aarav Singh | Finance | 85000 3 | Nisha Singh | Marketing | 72000 4 | Aditya Verma | IT | 80000 Write Python statements for the following tasks: I. Print the last three rows of the DataFrame df. II. Add a new column named "Experience" with values [5, 8, 10, 6, 7]. III. Delete the column "Salary" from the DataFrame. IV. Rename the column "Department" to "Dept". V. Display only the "Name" and "Salary" columns from the DataFrame.
Data Handling Using Pandas – I· 1 Mark· Q1· 2027 Sample Paper
A Pandas Series S1 is created with index labels ['a', 'b', 'c', 'd', 'e']. State whether the following statement is True or False: "The statement S1['b':'d'] will produce the same result as S1[1:3]."
Data Handling Using Pandas – I· 1 Mark· Q8· 2027 Sample Paper Python
What will be the output of the following code? import pandas as pd print(pd.Series(5, index=[0, 1, 2]))
  1. (A)A Series with values 5, 5, 5
  2. (B)A Series with value 5 only at index 0
  3. (C)A Series with values 0, 1, 2
  4. (D)Error
Data Handling Using Pandas – I· 1 Mark· Q12· 2027 Sample Paper
If we add two Pandas Series that do not have matching index labels, the result for those non-matching indices will be:
  1. (A)0
  2. (B)Error
  3. (C)NaN
  4. (D)Empty string
Data Handling Using Pandas – I· 1 Mark· Q18· 2027 Sample Paper
When creating a DataFrame from a list of dictionaries, the dictionary keys become:
  1. (A)Row indices
  2. (B)Data values
  3. (C)Column labels
  4. (D)Positional Index
Data Handling Using Pandas – I· 1 Mark· Q20· 2027 Sample Paper
Assertion (A) The statement df.drop('Science', axis=0) will remove the column labeled 'Science' from the DataFrame. Reason (R) In Pandas drop() method, axis=0 refers to row-wise operations and axis=1 refers to column-wise operations.
  1. (A)Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
  2. (B)Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
  3. (C)Assertion (A) is True and Reason (R) is False.
  4. (D)Assertion (A) is False, but Reason (R) is True.
Data Handling Using Pandas – I· 2 Marks· Q22· 2027 Sample Paper Python
(A) (i) Explain the use of the head() function in a Pandas DataFrame. (ii) What happens if the parameter n is not specified in the head() function? OR (B) Explain the concept of Boolean Indexing in DataFrames. Write a small Python code example to demonstrate it.
Data Handling Using Pandas – I· 2 Marks· Q28· 2027 Sample Paper Python
(A) Consider the following two dictionaries: dict1 = {'a': 10, 'b': 20} dict2 = {'a': 5, 'b': 10, 'c': 20} Write Python code to create a DataFrame from a list containing the above two dictionaries. OR (B) Mention the purpose of read_csv() and explain the use of its sep parameter.
Data Handling Using Pandas – I· 3 Marks· Q30· 2027 Sample Paper Python
(A) (i) Write a Python program to create a Pandas Series named Inventory from the following dictionary: stock = {'Pens': 150, 'Erasers': 80, 'Sharpeners': 60, 'Notebooks': 200}. (ii) Consider two Series S1 and S2: import pandas as pd S1 = pd.Series([10, 20], index=['a', 'b']) S2 = pd.Series([30, 40], index=['b', 'c']) Write the output of the statement: print(S1 + S2) OR (B) Consider a DataFrame df as shown below: Name IP Maths 0 Arpit 95 88 1 Vani 89 92 2 Chetan 78 80 Write Pandas statements to perform the following actions: (i) Add a new column 'Total' containing the values [183, 181, 158]. (ii) Rename the 'Name' column to 'Student'. (iii) Delete the 'Maths' column from the DataFrame.
Data Handling Using Pandas – I· 5 Marks· Q36· 2027 Sample Paper Python
(i) Create a DataFrame named StoreDF as shown below using dictionary of series: Items | Quantity | Unit_Price 0 Bread | 50 | 30 1 Milk | 100 | 25 2 Eggs | 120 | 6 Write suitable Pandas statements to Perform the following operations: (ii) Add a new row containing data [Butter, 40, 55] (iii) Display values of Items column only,