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

Practical for Class XII

Uploaded by

itxfaraz15
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)
17 views

Practical for Class XII

Uploaded by

itxfaraz15
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/ 19

Practical for Class XII

Python Pandas
1 .Find the sum of those values which are ending with 3 or 5.
2. Create a series of 10 numbers starting with 41 and with the increment of 3.
Now add 7 all odd values and subtract 3 in even values. Reprint the updated
series.
3. Create a series of 10 numbers. Change the value of all the elements those
values are multiples of 4.
4. Create a series and print the top 3 elements using the head function.
5. Create a series and print the last 3 elements using the tail function.
6. Create a series with these numbers: 21, 51, 71, 31, 12. Exchange all these
values of series by shifting each of them one to one position before and by
shifting the first value to last position.
7. Create a dataframe named as students using a list of names of 5 students
8. Create a dataframe players using a list of names and scores of the previous
three matches.
9. Create a dataframe countries using a dictionary which stored country name,
capitals and populations of the country.
10. Make a total of score from the dataframe players and display their rank
according their scores.
11. Print the batsman name along with runs scored in Test and T20 using
column names and dot notation.
12. Display the Batsman name along with runs scored in ODI using loc.
13. Display the batsman details who scored

 More than 2000 in ODI


 Less than 2500 in Test
 More than 1500 in T20
Practical for Class XII
Matplotlib( Data Visualization)
1. Plot following data on line chart and follow the given instructions:

Day Monday Tuesday Wednesday Thursday Friday


Income 510 350 475 580 600
 Write a title for the chart "The Weekly Income Report".
 Write the appropriate titles of both the axes.
 Write code to Display legends.
 Display red color for the line.
 Use the line style – dashed
 Display diamond style markers on data points
2. Consider the following data of a medical store and plot the data on the line
chart and Customize the chart as you wish:
Month Masks Sanitizer Hand wash
March 1500 4400 6500
April 3500 4500 5000
May 6500 5500 5800
June 6700 6000 6300
July 6000 5600 6200
August 6800 6300 4500

Use above data and subplot sanitizer data and handwash data.
3. Display following bowling figures through bar chart:
Overs Runs
1 6
2 18
3 10
4 5
Practical for Class XII
Python Pandas
Solutions:
Q.1. Create a series of these numbers:
33,55,65,29,19,23.
Find the sum of those values which are ending with 3 or 5.

Ans.1:

Output:

Q2. Create a series of 10 numbers starting with 41 and with the increment of 3.
Now add
7 all odd values and subtract 3 in even values. Reprint the updated series.

Ans.2:
Output:

1. Create a series of 10 numbers. Change the value of all the elements those
values are multiples of 4.
Code:
Output:

2. Create a series of 10 numbers starting with 41 and with the increment of


3. Now add 7 all odd values and subtract 3 in even values. Reprint the
updated series.
Code:

Output:
3. Create a series of 10 numbers. Change the value of all the elements those
values are multiples of 4.
Code:
Output:

4. Create a series and print the top 3 elements using the head function.
Code:
Output:

5. Create a series and print the bottom 3 elements using the tail function.
Code:
6. Create a dataframe named as students using a list of names of 5
students.
Code:

Output:

7. Create a dataframe players using a list of names and scores of the


previous three matches. (Using Nested list)
Code:

Output:

8. Create a dataframe countries using a dictionary which stored country


name, capitals and populations of the country.
Code:

Output:

9. Iterate dataframe created in question no. 8 by its rows.


Code:

Output:
10. Print scores of previous two matches along with their names using
iterrows function. (Use dataframe created in question 8)
Code:

Output:

11. Make a total of score from the dataframe players and display their
rank according the their scores.
Code:

Output:
12. Print the batsman name along with runs scored in Test and T20 using
column names and dot notation.
Code:

Output:
13. Display the Batsman name along with runs scored in ODI using loc.
Code:

Output:

14. Display the batsman details who scored


a. More than 2000 in ODI
b. Less than 2500 in Test
c. More than 1500 in T20
Code:

Output:
Practical for Class XII
Matplotlib( Data Visualization)
1.
Code:

Output:
2.
Code:

Output:
Code:

Output:
3.
Code:

Output

You might also like