AI Practical Project
AI Practical Project
COOCHBEHAR
AFFLIATION NO.: 2430158
SCHOOL CODE: 15727
AISSCE
SESSION: 2024-25
NAME:________________________________________________________________________________
CLASS:-X SECTION: A / B/ C
ROLL NO.(Board’s):__________________________________________________________________
me in doing a lot of research and I came to know about so many new things I am
Secondly I would also like to thank my parents and friends who helped me a lot in
Date: _________________
Name: _____________________________________________________________
Class: X Section:____________________________
Roll No.(Board’s):_____________________________________________________
ABOUT PYTHON
Python is a programming language that is interpreted, object-oriented, and considered to be high-level too.
What is Python? Python is one of the easiest yet most useful programming languages which is widely used in
the software industry. People use Python for Competitive Programming, Web Development, and creating
software. Due to its easiest syntax, it is recommended for beginners who are new to the software
engineering field. Its demand is growing at a very rapid pace due to its vast use cases in Modern
Technological fields like Data Science, Machine learning, and Automation Tasks. For many years now, it has
been ranked among the top Programming languages.
Today Python is used in all kinds of development from game development, basic programming, and scripting
to large and complex software development. It has a large community support and is rich in the library,
having all kinds of frameworks for backend, frontend and you name it python has it all.
Python was created in 1980s by Guido van Rossum. During his research at the National Research Institute
for Mathematics and Computer Science in the Netherlands, he created Python – a super easy programming
language in terms of reading and usage. The first ever version was released in the year 1991 which had only
a few built-in data types and basic functionality.
Later, when it gained popularity among scientists for numerical computations and data analysis, in 1994,
Python 1.0 was released with extra features like map, lambda, and filter functions. After that adding new
functionalities and releasing newer versions of Python came into fashion.
Python 1.5 released in 1997
Python 2.0 released in 2000
Python 3.0 in 2008 brought newer functionalities
The latest version of Python, Python 3.11 was released in 2022.
Newer functionalities being added to Python makes it more beneficial for developers and improved its
performance. In recent years, Python has gained a lot of popularity and is a highly demanding programming
language. It has spread its demand in various fields which includes machine learning, artificial
intelligence, data analysis, web development, and many more giving you a high-paying job.
(What is Python? Its Uses and Applications - GeeksforGeeks, https://www.geeksforgeeks.org/)
PYTHON CODE
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
defFun():
print(":)")
print("#1. For checking the data.")
print("#2. Reading complete file without index.")
print("===================")
print("Topic - Data Visualization")
print(" ")
print("#3. Line Chart")
print(" Press 1 to print the data for Confirmed cases as per Districts.")
print(" Press 2 to print the data for Recovered cases as per Districts.")
print(" Press 3 to print the data for Death cases as per Districts.")
print(" Press 4 to print the data for Active cases as per Districts.")
print(" Press 5 to print All data.")
print(" ")
print("#4. Bar Graph")
print(" Press 1 to print the data for Confirmed cases as per Districts.")
print(" Press 2 to print the data for Recovered cases as per Districts.")
print(" Press 3 to print the data for Death cases as per Districts.")
print(" Press 4 to print the data for Active cases as per Districts.")
print(" Press 5 to print the data in form of stack bar chart")
print(" Press 6 to print the data in form of multi bar chart")
print(" ")
print("#5. Scatter Chart")
print(" ")
print("#6. For Exit")
print("===============")
defRead_CSV():
print("The Data")
df=pd.read_csv('C:\\Covid_data_kerala.csv')
print(df)
defNo_Index():
print("Reading the file without index")
df=pd.read_csv('C:\\Covid_data_kerala.csv', index_col=0)
print(df)
defline_plot():
df=pd.read_csv('C:\\Covid_data_kerala.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM','I
DK','WYD','KGD']
District=df["Districts"]
Confirmed=df["Confirmed"]
Recovered=df["Recovered"]
Deaths=df["Deaths"]
Active=df["Active"]
plt.xlabel("Districts")
YC = int(input("Enter the number representing your preferred line chart
from the above choices: "))
if YC == 1:
plt.ylabel("Confirmed Cases")
plt.title("Districts Wise Confirmed Cases")
plt.plot(District, Confirmed, color='b')
plt.show()
elif YC == 2:
plt.ylabel("Recovered Cases")
plt.title("Districts Wise Recovered Cases")
plt.plot(District, Recovered, color='g')
plt.show()
elif YC == 3:
plt.ylabel("Death Cases")
plt.title("Districts Wise Death Cases")
plt.plot(District, Deaths, color='r')
plt.show()
elif YC == 4:
plt.ylabel("Active Cases")
plt.title("Districts Wise Active Cases")
plt.plot(District, Active, color='c')
plt.show()
elif YC == 5:
plt.ylabel("Number of cases")
plt.plot(District, Confirmed, color='b', label = "Districts Wise Confirmed
Cases")
plt.plot(District, Recovered, color='g', label = "Districts Wise Recovered Cases")
plt.plot(District, Deaths, color='r', label = "Districts Wise Death Cases")
plt.plot(District, Active, color='c', label = "Districts Wise Active Cases")
plt.legend()
plt.show()
else:
print("Enter valid input")
defbar_plot():
df = pd.read_csv('C:\\Covid_data_kerala.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM','I
DK','WYD','KGD']
District = df["Districts"]
Confirmed = df["Confirmed"]
Recovered = df["Recovered"]
Deaths = df["Deaths"]
Active = df["Active"]
plt.xlabel("Districts")
YC = int(input("Enter the number representing your preferred bar graph
from the above choices:"))
if YC == 1:
plt.ylabel("Confirmed Cases")
plt.title("Districts Wise Confirmed Cases")
plt.bar(District, Confirmed, color='b', width = 0.5)
plt.show()
elif YC == 2:
plt.ylabel("Recovered Cases")
plt.title("Districts Wise Recovered Cases")
plt.bar(District, Recovered, color='g', width = 0.5)
plt.show()
elif YC == 3:
plt.ylabel("Death Cases")
plt.title("Districts Wise Death Cases")
plt.bar(District, Deaths, color='r', width = 0.5)
plt.show()
elif YC == 4:
plt.ylabel("Active Cases")
plt.title("Districts Wise Active Cases")
plt.bar(District, Active, color='c', width = 0.5)
plt.show()
elif YC == 5:
plt.bar(District, Confirmed, color='b', width = 0.5, label = "Districts Wise
Confirmed Cases")
plt.bar(District, Recovered, color='g', width = 0.5, label = "Districts Wise
Recovered Cases")
plt.bar(District, Deaths, color='r', width = 0.5, label = "Districts Wise Death
Cases")
plt.bar(District, Active, color='c',width = 0.5, label = "Districts Wise Active
Cases")
plt.legend()
plt.show()
elif YC == 6:
D=np.arange(len(District))
width=0.25
plt.bar(D,Confirmed, width, color='b', label = "Districts Wise Confirmed
Cases")
plt.bar(D+0.25, Recovered, width, color='g', label = "Districts Wise Recovered
Cases")
plt.bar(D+0.50, Deaths, width, color='r', label = "Districts Wise Death Cases")
plt.bar(D+0.75, Active ,width, color='c', label = "Districts Wise Active Cases")
plt.legend()
plt.show()
else:
print("Enter valid input")
defscatter_chart():
df=pd.read_csv('C:\\Covid_data_kerala.csv')
df['Districts'] =
['EKM','PTA','KTM','TSR','KKD','MPM','KLM','PKD','ALP','KNR','TVM','I
DK','WYD','KGD']
District = df["Districts"]
Confirmed = df["Confirmed"]
Recovered = df["Recovered"]
Deaths = df["Deaths"]
Active = df["Active"]
SC=plt.gca()
SC=plt.scatter(District, Confirmed, color="b", label="Districts Wise
Confirmed Cases")
SC=plt.scatter(District, Recovered, color="g", label="Districts Wise
Recovered Cases")
SC=plt.scatter(District, Deaths, color="r", label="Districts Wise Death
Cases")
SC=plt.scatter(District, Active, color="c", label="Districts Wise Active
Cases")
plt.xlabel("District")
plt.title("Complete Scatter Chart")
plt.legend()
plt.show()
Fun()
YC = int(input("Enter Your Choice: "))
while YC == 1 or 2 or 3 or 4 or 5 or 6:
if YC == 1:
Read_CSV()
break
elif YC == 2:
No_Index()
break
elif YC == 3:
line_plot()
break
elif YC == 4:
bar_plot()
break
elif YC == 5:
scatter_chart()
break
elif YC == 6:
print("Thank You for using...")
break
else:
print("Enter valid input")
break
OUTPUT
Note: According to our choice different types of plot will come in our screen.
BIBLIOGRAPHY
Books
Artificial Intelligence – Sumita Arora
Dhanpat Rai Publication
WEBSITES
ladderpython.com
w3schools.com