Activity 12: Write a program to display a scatter chart for the following points (2,5),
(9,10),(8,3),(5,7),(6,18).
Code:
import [Link] as plt
x=[2,9,8,5,6]
y=[5,10,3,7,18]
[Link](x,y)
[Link]("Line chart")
[Link]()
O/P:
Activity 13: Write a program to display bar chart for the following data with
appropriate titles:
Subjects=[“Eng”,”Sci”,”Soc”,”Maths”,”AI”]
Marks=[89,87,78,90,99]
Code:
import [Link] as plt
Sub=["Eng","Sci","Soc","Maths","AI"]
Marks=[89,87,78,90,99]
[Link](Sub,Marks)
[Link]("Term-1 Performance")
[Link]("Subjects")
[Link]("Marks")
[Link]()
0/P:
Activity 14: Write a program to display histogram for the following data with
appropriate titles:
stu=[5,14,17,23,34,50,20,34,24,56,45,34,23,34,32,9,8,22,24,34,55,66,23,23 ]
Code:
import [Link] as plt
stu=[5,14,17,23,34,50,20,34,24,56,45,34,23,34,32,9,8,22,24,34,55,66,23,23]
[Link](stu,bins=[0,10,20,30,40,50,60,70])
[Link]("Marks")
[Link]("[Link] Students")
[Link]("Marks Obtained by the Students")
[Link]()
O/P:
Activity 15: Write a program to display Pie-chart for the following data with
appropriate titles:
Code:
import [Link] as plt
x=["Food","Rent","Shopping","Education","others"]
values=[20,30,25,35,50]
[Link](values,labels=x)
[Link]("Expenditure")
[Link]()
Activity 16: Read CSV file saved in your system and display 5 rows
Code:
import pandas as pd
df=pd.read_csv(r"C:\Users\ADMIN\Desktop\[Link]",nrows=10)
print(df)
O/P:
RNO NAME MARKS
1 HARI 67
2 RAMESH 89
3 SOMESH 56
4 RAJESH 78
5 BHIMESH 45
Activity 17: Read CSV file saved in your system and display its information
Code:
import pandas as pd
df=pd.read_csv(r"C:\Users\ADMIN\Desktop\[Link]",nrows=10)
print(df)
O/P
RNO NAME MARKS
1 HARI 67
2 RAMESH 89
3 SOMESH 56
4 RAJESH 78
5 BHIMESH 45
6 SRIKANTH 67
7 SRINIVAS 89
8 SANDHYA 90
9 SADANA 56
10 RAJU 45
Activity 18: Write a program to read an image and display using Python
Code:
import cv2
img=[Link]("[Link]")
[Link]('Image',img)
[Link](0)
O/P
Activity 19: Write a program to read an image and display image shape and
size using Python
Code:
import cv2
img=[Link](r"C:\Users\ADMIN\Desktop\[Link]")
[Link]('myimg',img)
print("The shape of the image is",[Link])
print("The Size of the image is",[Link])
[Link](0)
O/P:
The shape of the image is (148, 259, 3)
The Size of the image is 114996
Activity 20: Write a Python program to draw a circle and fill it with a colour
Code
import turtle
t = [Link]()
[Link](1)
[Link]("blue")
[Link] fill()
[Link]("yellow")
[Link](100)
t.end_fill()
[Link]()
Output