0% found this document useful (0 votes)
13 views5 pages

Xii Ip HHW 2025

The document outlines summer vacation homework for Class XII students, focusing on Python programming and the use of the Pandas library. It includes tasks such as filling in code blanks, predicting outputs, creating series and dataframes, and answering questions related to data manipulation. The exercises aim to enhance students' understanding of Python and data handling using Pandas.

Uploaded by

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

Xii Ip HHW 2025

The document outlines summer vacation homework for Class XII students, focusing on Python programming and the use of the Pandas library. It includes tasks such as filling in code blanks, predicting outputs, creating series and dataframes, and answering questions related to data manipulation. The exercises aim to enhance students' understanding of Python and data handling using Pandas.

Uploaded by

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

PM SHRI KV BONDAMUNDA

CLASS-XII (IP)
SUMMER VACATION HOLIDAY HOME WORK 2025-26
1. The following table shows the python code and its expected output. Choose
the correct word for blank space in line 3 for printing the column:
A. index B. column C. col D. heads
Python code Output

1 import pandas as pd r1 10
2 x = [10, 20 30] r2 20
3 ser = pd.Series(x, =["r1", "r2", "r3"]) r3 30
4 print(ser)

2. What is the correct output for following Python code:


import pandas as pd
data = {"Marks1": 90, "Marks2": 95, "Marks3": 97}
ser = pd.Series(data)
print(ser)
A. Marks1 90
Marks2 95
Marks3 97
dtype:
int64

B. Marks1 Marks2 Marks3 90 95 97


C. Marks1 90
Marks2 95
Marks3 97
dtype:
int16

D. Marks1 Marks2 Marks3 90 95 97

3. Predict the output of the given Python code:

import pandas as

pd list1=[-10,-20,-

30]

ser = pd.Series(list1*2)

print(ser)

4,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[ ])

5. Write a program to create a series object using a dictionary that stores the number
of students

in each house of class 12D of your school.

Note: Assume four house names are Beas, Chenab, Ravi and Satluj having 18, 2, 20, 18

students respectively and Pandas library has been imported as pd.

6. Which of the following code will generate the following output?

Jan 31

Feb 28

Mar 31

dtype:

int64

(a) import pandas

S1 = pd.Series(data = [31,28,31], index=["Jan","Feb","Mar"])

print(S1)

(b) import pandas as pd

S1 = p1.series([31,28,31],

index=["Jan","Feb","Mar"]) print(S1)

(c) import pandas as pd

S1 = pd.Series([31,28,31],

columns=["Jan","Feb","Mar"]) print(S1)

(d) import pandas as pd

S1 = pd.Series([31,28,31], index=["Jan","Feb","Mar"])
print(S1)

7. Consider the following DataFrame ‘df’ and answer following questions:

rollno name UT1 UT2 UT3 UT4

01 Prerna Singh 24 24 20 22

12 Manish Arora 18 17 19 22

23 Tanish Goel 20 22 18 24

34 Falguni Jain 22 20 24 20

45 KanikaBhatnagar 15 20 18 22

56 Ramandeep Kaur 20 15 22 24

(a) The teacher needs to know the roll no, name and marks scored by the student
with roll number 4. Help her to write the code.

(b) Ms. Sharma, the class teacher wants to add a new column, the ‘Grade’ with
the values, ‘ A’, ‘B’, ‘A’, ‘A’, ‘B’, ‘A’ ,to the DataFrame. Help her to write code.

8. Consider the following DataFrame, named ‘Stud’

Name Rollno English Hindi Maths Ssc Science

0 Aman 101 65 54 87 69 74

1 Suman 102 69 64 90 87 59

2 Priya 103 75 72 98 90 75

3 Tahir 104 88 80 78 45 87

4 Bharti 105 45 53 81 69 98

Write commands to:

i. Display the Name and Rollno.

ii. Add a new row with values ( Rakesh ,106, 79 , 86, 91, 77, 93)

9. Consider the Dataframe DF as shown below.NOTE:Libraries has been imported.

A B C

0 10 20 30
1 40 50 60

What will be the output of the following code?

a) print(“I :”,DF.iloc([0][0]) b) print(“II :”,DF.loc([0][‘C’])

10.4. Write the correct output on execution of the following Pandas code

import pandas as pd

df = pd.DataFrame({“A”:[“p01”, “p02”, “p03”], “B” : [“Pen”, “Pencil”, “Eraser”]})

df = df.rename(columns = {“A”:”PID”, “B”:”PNAME”})

df = df.rename(index = {0:“A”, 1:”B”, 2:”C”})

print(df)

11. 1.Consider a DataFrame (MRK) given below:

NAME PHY CHEM

S1 ATUL 51 35

S2 ANIL 62 61

S3 ANUJ 45 46

(A) Write commands to create the DataFrame (MRK) using a Dictionary of Lists

(B) If a DataFrame is created using a 2D dictionary, then the column labels are
formed from the inner dictionary’s keys or outer dictionary’s keys?

12. What do you mean by Series in Python? Give all the methods of creating series
in pandas.

13. Explain all the attributes and methods of series in pandas.

14. Consider the following Series object “S1” and write the output of the
following statement:

import pandas as pd

L1=[21, 41, 62, 81, 23, 45, 68, 89]

S1 = pd.Series(L1)

print("1.

",S1.index)
print("2. ",S1.values)

print("3. ",S1.shape)

print("4. ",S1.ndim)

print("5. ",S1.size)

print("6. ",S1.nbytes)

print("7. ",S1[0])

print("8. ",S1[2]+S1[0])

print("9. ",S1[5]**2)

print("10. ",S1.empty)

print("11.\n",S1[[1, 5,

6]])

print("12.\n",S1[5 : 7],"\n")

print("13.\n",S1[: : -1])

print("14.\n",S1>60)

print("15.\n",S1[S1>60])

print("16.\n",len(S1))

print("17.\n",S1.count())

print("18.\n",S1.head())

print("19.\n",S1.tail())

print("20.\n",S1[4:5] + S1[4:5])

15. What is DataFrame? Explain all the methods of creating a data frame
With examples.

16. Explain all the attributes and methods of DataFrame in pandas.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy