0% found this document useful (0 votes)
22 views2 pages

IP XII Worksheet 2

The document is a worksheet for Class XII Informatics Practices focusing on Pandas, covering various topics such as DataFrame mutability, Series organization, and basic operations in Python. It includes multiple-choice questions, coding exercises, and tasks to create and manipulate DataFrames. The exercises aim to enhance students' understanding of data handling using the Pandas library.

Uploaded by

nihalkatiyar555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

IP XII Worksheet 2

The document is a worksheet for Class XII Informatics Practices focusing on Pandas, covering various topics such as DataFrame mutability, Series organization, and basic operations in Python. It includes multiple-choice questions, coding exercises, and tasks to create and manipulate DataFrames. The exercises aim to enhance students' understanding of data handling using the Pandas library.

Uploaded by

nihalkatiyar555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MANTORA PUBLIC SCHOOL, KALYANPUR

Class – XII
Subject – Informatics Practices (065)

Worksheet – 2 (Pandas-I)

1- Assertion (A): DataFrame and its size is mutable in Pandas.


Reasoning (R): Data in a Series is organised in a single column.
a. Both A and R are true and R is the correct explanation for A
b. Both A and R are true but R is not the correct explanation for A
c. A is True but R is False
d. A is false but R is True

2- Which of the following function is used in Pandas to display the first few rows of a specific column in a
DataFrame?
a. show( )
b. display( )
c. head( )
d. view( )

3- Find the output of the following code:


import pandas as pd
lst1=[20,35,40]
ser1=pd.Series([20,35,40])
print(lst1+ lst1)
print(ser1+ser1)

4- Predict the output of the given Python code:


import pandas as pd
list1=[-10,-20,-30]
ser = pd.Series(list1*2)
print(ser)

5- 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[ ___________ ]

7- 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:
8- Consider a given Series , M1:

Write a program in Python Pandas to create the series.

9- 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.

10- Write a program in Python Pandas to create the following DataFrame batsman from a Dictionary:

Perform the following operations on the DataFrame :


1)Add both the scores of a batsman and assign to column “Total”
2)Display the highest score in both Score1 and Score2 of the DataFrame.
3)Display the DataFrame.
4)To add column after „Name‟ called „City‟ which the following data:[„Lucknow‟, „Kanpur‟,‟Delhi‟, „Noida‟].

You might also like