0% found this document useful (0 votes)
1K views31 pages

Ip Practical File

The document contains details of a student named Shreya Kathait's IP practical file. It includes a certificate signed by the teacher certifying that the student has successfully completed and submitted the project on time. It also includes an acknowledgement from the student thanking the teacher and school authorities for their support and guidance. The practical file contains 20 questions on data handling using Pandas and 5 questions on data visualization. For each question, the code and output is provided.

Uploaded by

Shreya Kathait
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)
1K views31 pages

Ip Practical File

The document contains details of a student named Shreya Kathait's IP practical file. It includes a certificate signed by the teacher certifying that the student has successfully completed and submitted the project on time. It also includes an acknowledgement from the student thanking the teacher and school authorities for their support and guidance. The practical file contains 20 questions on data handling using Pandas and 5 questions on data visualization. For each question, the code and output is provided.

Uploaded by

Shreya Kathait
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/ 31

IP PRACTICAL

FILE
NAME: SHREYA KATHAIT

CLASS: 12-D

ROLL NO.: 33

Session- 2022-23
CERTIFICATE

This is to certify that Shreya Kathait of class 12-D has


successfully completed and submitted on time the project on
topic IP Practical File as prescribed by Ms. Anu Bhatia during
the academic year2022-2023 as per the guidelines given.

Sign of Teacher
ACKNOWLEDGEMENT

I wish to express my deep sense of gratitude and indebtedness


to our Informatic Practices teacher
Ms. Anu Bhatia for this invaluable help, advice and guidance in
the preparation of this project.
I am also greatly indebted to our principal Ms. Santosh Vyas
and school authorities for providing me with the facilities and
requisite laboratory conditions for making this practical file.
I also extend my thanks to my parents, my classmates and
friends who helped me to complete this practical file
successfully and on time.

Sign of Teacher
TABLE OF CONTENTS
No Practical Signature

1 Data handling using Pandas


1 Write a Python program to demonstrate the addition and
deletion of columns in a dataframe.

2 Write a Pandas program to add and subtract any two Pandas


Series.

3 Write a Pandas program to multiply and divide any two Pandas


Series.

4 Create a series from a dictionary of alphabets and their


corresponding words. Take the total number of key-value pairs and
the keys and values from the user
5 Create a series and print the last 3 elements of series using the
tail function.
6 Create a series and print the first n elements of series using the
head function. Take n from user

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


stores country name, capitals and populations of the country.

10 Show addition and deletion of rows in dataframe made in


question 9

11 Write a Python Program to perform head( ) , tail ( ) and


Transpose Functions on the following dataframe.
12 From the dataframe in question 11, show the data of Ramit and
Mallika where they both have scored more than 90. ( Boolean
indexing )

13 Create the following DataFrame Sales containing year wise sales


figures for five sales persons in INR. Use the years as column
labels, and sales person names as row labels.
2014 2015 2016 2017
Madhu 700 700 5000 700
Kusum 2100 2100 2100 2150
Kinshuk 1300 1310 1350 1370
Ankit 878 878 878 878
Shruti 987 978 977 987
Display the shape and size of Sales
14 Add the following data in the above dataframe for year 2018
Madhu 160000,
Kusum 110000,
Kinshuk 500000,
Ankit 340000,
Shruti 900000
15 From the dataframe in question 8, Display the batsman details who
scored (Boolean indexing)
• More than 2000 in ODI
• Less than 2500 in Test
• More than 1500 in T20
16 Write a program to display all the elements greater than 100
from a Series

17 Create a series of your choice with 10 vales and find the sum of
those values which are ending with 3 or 5.

18 Create a series and give appropriate index name and series name.

19 Write a Pandas program to create a series from a list shows the


attributes of series.
(values, index, size, shape, dtype, empty, hasnans)
20 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.
2
Part 2 Data Visualization
21 Given the following data of rainfall in different zones of India in
mm for 12 months, Create multiple lines chart in a figure to
observe any trends from Jan to Dec.
Zones|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
North|14 | 13 | 13 | 19 | 16 | 20 | 15 |17 | 19 | 17|15 |12|
South| 16 | 20 | 13 | 20 | 20 | 17 | 11 |16 | 13 |14 | 17| 20|

22 Write a program to plot a histogram of ages of 80 participants in


some game from given data with 6 bins of your choice.
Data = [ 9,10,11,13,13,15,16,17,18,19,21,23, 23,23,24,24, 25, 25
,25,25,25,26,26,27,27,27, 27, 29,30,30,30,30, 31,33,34, 34,35 ,36,
36,37,37,37, 38,39,40,40,40,41 ,42,43,43,39,30,
31,32,33,34,35,36,37,38,39,36,37,38, 40,41,42,43, 44,45,
50,51,52,53,54,55,56,57,58]
23 Consider the following data of a medical store and plot the data
on the bar 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
24 Write a program in Python Pandas to create the following
DataFrame “df” from a Dictionary. Draw line charts to show the
plotting of score1 and score 2 for all batsman. Change font size
of the titles to 15 and color to green.
B_No Name Score1 Score2
1 M.S. Dhoni 95 80
2 Virat Kohli 85 92
3 Sachin 110 75
4 Kartik 75 80

25 Create a histogram of 5 equal bins from the following score of a


test given to students out of 50 marks.
Test-scores 20, 25, 30, 45, 30, 42, 32, 34, 42, 35, 44, 24, 25, 48, 50,
39, 38, 50, 27, 49, 22, 24, 26, 27, 30, 38, 34, 40, 35, 47, 41, 44, 49,
45, 48, 44
26 Consider the data given below. Create a bar chart depicting the
downloads of the app.

App Name App Price in Rs. Total Downloads


Angry Bird 75 197000
Teen Titan 120 209000
Marvel Comics 190 414000
ColorMe 245 196000
Fun Run 550 272000
Crazy Taxi 55 311000
Data handling using Pandas

1. Write a Python program to demonstrate the addition and


deletion of columns in a dataframe.

CODE:

OUTPUT:
2. Write a Pandas program to add and subtract any two Pandas
Series.
CODE:

OUTPUT:
3. Write a Pandas program to multiply and divide any two Pandas
Series.
CODE:
OUTPUT:

4. Create a series from a dictionary of alphabets and their


corresponding words. Take the total number of key-value pairs and
the keys and values from the user
CODE:

OUTPUT:
5. Create a series and print the last 3 elements of series using the tail
function.
CODE:

OUTPUT:
6. Create a series and print the first n elements of series using the
head function. Take n from user
CODE:

OUTPUT:
7. Create a dataframe named as students using a list of names of 5
students
CODE:
OUTPUT:

8. Create a dataframe players using a list of names and scores of


the previous three matches.
CODE:

OUTPUT:
9. Create a dataframe countries using a dictionary which
stores country name, capitals and populations of the country.
CODE:

OUTPUT:

10. Show addition and deletion of rows in dataframe made in


question 9.
CODE:
OUTPUT:

11. Write a Python Program to perform head( ) , tail ( ) and


Transpose Functions on the following dataframe.
CODE:

OUTPUT:
12. From the dataframe in question 11, show the data of Ramit
and Mallika where they both have scored more than 90. ( Boolean
indexing )
CODE:

OUTPUT:

13. Create the following DataFrame Sales containing year wise sales
figures for five sales persons in INR. Use the years as column
labels, and sales person names as row labels.
2014 2015 2016 2017
Madhu 700 700 5000 700
Kusum 2100 2100 2100 2150
Kinshuk 1300 1310 1350 1370
Ankit 878 878 878 878
Shruti 987 978 977 987
Display the shape and size of Sales
CODE:

OUTPUT:

14. Add the following data in the above dataframe for year 2018
Madhu 160000,
Kusum 110000,
Kinshuk 500000,
Ankit 340000,
Shruti 900000
CODE:
OUTPUT:

15. From the dataframe in question 8, Display the batsman details who
scored (Boolean indexing)
• More than 2000 in ODI
• Less than 2500 in Test
• More than 1500 in T20
CODE:

OUTPUT:
16. Write a program to display all the elements greater than 100
from a Series
CODE:

OUTPUT:
17. Create a series of your choice with 10 vales and find the sum
of those values which are ending with 3 or 5.
CODE:

OUTPUT:

18. Create a series and give appropriate index name and series
name.
CODE:

OUTPUT:
19. Write a Pandas program to create a series from a list shows the
attributes of series.
(values, index, size, shape, dtype, empty, hasnans)
CODE:

OUTPUT:
20. 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:
Part 2 Data Visualization
1. Given the following data of rainfall in different zones of India in mm
for 12 months, Create multiple lines chart in a figure to observe
any trends from Jan to Dec.
Zones|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
North|14 | 13 | 13 | 19 | 16 | 20 | 15 | 17 | 19 | 17|15 | 12|
South| 16 | 20 | 13 | 20 | 20 | 17 | 11 |16 | 13 |14 | 17| 20|

CODE:

OUPUT:
2. Write a program to plot a histogram of ages of 80 participants in
some game from given data with 6 bins of your choice.
Data = [ 9,10,11,13,13,15,16,17,18,19,21,23,23,23,24,24,25, 25,25,
25,25,26, 26,27,27,27,27,29,30,30,30,30,31,33,34,34,35, 36,36,37,
37,37,38,39,40,40, 40,41,42,43,43,39,30,31,32,33,34,35,36,37,
38,39,36,37,38,40,41,42,43, 44,45, 50,51,52,53,54,55,56,57,58]

CODE:

OUTPUT:
3. Consider the following data of a medical store and plot the data on
the bar 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
CODE:

OUTPUT:
4. Write a program in Python Pandas to create the following DataFrame
“df” from a Dictionary. Draw line charts to show the plotting of
score1 and score 2 for all batsman. Change font size of the titles to
15 and color to green.

B_No Name Score1 Score2


1 M.S. Dhoni 95 80
2 Virat Kohli 85 92
3 Sachin 110 75
4 Kartik 75 80

CODE:

OUTPUT:
5. Create a histogram of 5 equal bins from the following score of a
test given to students out of 50 marks.
Test-scores 20, 25, 30, 45, 30, 42, 32, 34, 42, 35, 44, 24, 25, 48, 50, 39,
38, 50, 27, 49, 22, 24, 26, 27, 30, 38, 34, 40, 35, 47, 41, 44, 49, 45, 48,
44

CODE:

OUPUT:
6. Consider the data given below. Create a bar chart depicting the
downloads of the app.

App Name App Price in Rs. Total Downloads


Angry Bird 75 197000
Teen Titan 120 209000
Marvel Comics 190 414000
ColorMe 245 196000
Fun Run 550 272000
Crazy Taxi 55 311000

CODE:

OUTPUT:

You might also like