You are on page 1of 2

INDIAN SCHOOL AL GHUBRA

INFORMATICS PRACTICES(065)
CLASS XII IP (2022-2023)
Topic : Series and Dataframes (Lab Work Sheet-1)
1. Write a Python program to create the following Series A:
P 30
Q 22
R 13
S 15
T 14
Include code to perform the following operations in it:
(a) Display the indices of A.
(b) Display the power of the values of A raised to 2.
(c) Display the first 3 rows and last 2 rows of A.
(d) Display the even elements of A and elements less than 25.
2. Create a Series with Values: Grades= [9.5,6.7,8.8,9.1,7.5,6.7,5.5,4.7,5.4.6.8].Indices:
Names=Amit, Sneha, Manya, Pari, Lavanya, Priya, Arya, Ronald, Tim, Sam.
1) List only the students who got grade > 7.5
2) List the students who got < 5
3) Give a grace mark 5 to all.
4) Convert the grades to 50s (All given grades are out of 10)
3. Write a Pandas menu-based program to 1)add 2)subtract 4) multiple and 5)divide
two Pandas Series:
P1= [2,4, 6, 8,10]
Q2= [3, 5, 7,9,11
4.

5. Create two Dataframes Df1 and Df2 and perform the operations specified:-
Df1 Df2
M1 M2 M1 M2
01 73 69 01 39 75
02 65 52 02 82 59
03 98 85 03 77 74
1) Add the corresponding Columns
2) Multiply the 2 dataframes
3) Modify labels M1 and M2 with Subject names IP and BST in Df1 and Df2
4) Delete 03 and add a new row with index 07 in Df1 with marks 100 , 100

6. Create a dataframe df as shown below:


City Maxtemp Mintemp Rainfall
Delhi 40 13 24.1
Bengaluru 31 18 36.2
Chennai 35 27 40.8
Mumbai 30 21 35.2
Kolkata 39 23 41.8
1) Display details of Delhi and Bengaluru.
2) Change Max temp of Chennai to 37.
3) Add Ahmedabad with values [42,26,31]to dataframe.
4) Add column population(in million) with values [18.98, 8.42, 7.06,18.41,14.85,5.57]

7. Create a dataframe fruit as shown below:

Fruit Color Price


0 Apple Red 120
1 Mango Yellow 150
2 Grapes Red 100
4 Blue berry Blue 130
Perform the following operations on the dataframe:
1) Add a new fruit { ‘Guava’, ‘Green’, ' 200'} to the data frame.
2) Add a new column ‘Weight in g’ to the dataframe with values{195,200,5,0.5,200}
3) Display information about ‘Blue berry’.
4) Delete column Price.

8. Create a dataframe stu as shown below:

ID Name Age Fav_Color Points


T01 Rahul Anand 32 Blue 73
T02 Mohak Girdhar 25 Green 82
T03 Rajeev Tyagi 45 Orange 29
T04 Rohini Malik 30 Pink 39
1) Extract and display the row T04 .
2) Add a new column ‘Height’ and fill it with values[150,155,160,172]
3) Delete the row T03.
4) Add a new row with values {T11, Gayathri, 25,Yellow,92,160}.

You might also like