IP Project
IP Project
PROJECT
ON
INDIAN
FOOD
NAME:
CLASS:
ROLL NO. :
CERTIFICATE
This is to certifyt hat of class ,
School, has successfully
completed her Investigatory Project as prescribed by CBSE in
the year .
Date :
RollNo.:
importpandasaspd
importmatplotlib.pyplotasplt
IndianFood=pd.read_csv("IndianFood.CSV")
print(IndianFood)
#MainMenu
while(True):
print("\n\n\n\t\t############MAINMENU###############")
print("\n\t\t\t5.VisualizeData")
print("\t\t###########################################")
ch=int(input("\t\tEnteryourchoice1-7:"))
if (ch==1):
while(True):
print("Add
Menu")print("1.Addnewcol
ch1=int(input("Enteryourchoice1-3")) if
(ch1==1):
name=input("Enterthenameofthenewcolumn")
data=input("Enterthevaluebywhichyouwanttoinitializethiscolumn")
IndianFood[name]=data
print(IndianFood)
elif(ch1==2):
name=input("EnternameoftheIndianFood")
ingredient=input("Enter ingredient")
diet=input("Enter diet")
prep=int(input("Enterpreparationtime"))
course=input("Enter course")
state=input("Enter state")
region=input("Enter region")
countrec=IndianFood.shape[0]
IndianFood.loc[countrec]=[name,ingredient,diet,prep,cook,flavor,course,state,region]
print(IndianFood)
else:
break
elif (ch==2):
while(True):
print("ModifyMenu")
print("2.Modifygivenfooditemdetails")
print("3. Exit")
ch1=int(input("Enteryourchoice1-3")) if
(ch1==1):
data=input("Enterthenewdata")
IndianFood.at[row,col]=data
print(IndianFood)
elif(ch1==2):
name=input("EnternameoftheIndianFood")
ingredient=input("Enter ingredient")
diet=input("Enter diet")
prep=int(input("Enterpreparationtime"))
course=input("Enter course")
state=input("Enter state")
region=input("Enter region")
countrec=IndianFood.shape[0]
IndianFood.loc[countrec]=[name,ingredient,diet,prep,cook,flavor,course,state,region]
print(IndianFood)
else:
break
elif (ch==3):
while(True):
print(" ")
print("|2.Deleterecordsofagivenstate(anyIndianstate) |")
print("| 3. Delete records of a given region: East/West/North/South |")
print("|4.Deleterecordsofagivencourse:dessert/maincourse/starter/snack|")
print(" ")
ch1=int(input("Enteryourchoice1-7:")) if
(ch1==1):
IndianFood.drop(IndianFood.loc[IndianFood['name']==data].index,inplace=True)
print(IndianFood)
elif(ch1==2):
IndianFood.drop(IndianFood.loc[IndianFood['state']==stat].index,inplace=True)
print(IndianFood)
elif(ch1==3):
IndianFood.drop(IndianFood.loc[IndianFood['region']==stat].index,inplace=True)
print(IndianFood)
elif(ch1==4):
stat=input("Enternameofthecoursewhosedetailsaretobedeleted")
IndianFood.drop(IndianFood.loc[IndianFood['course']==stat].index,inplace=True)
print(IndianFood)
elif(ch1==5):
IndianFood.drop(IndianFood.loc[IndianFood['flavor_profile']==stat].index,inplace=True)
print(IndianFood)
elif(ch1==6):
IndianFood.drop(IndianFood.loc[IndianFood['diet']==stat].index,inplace=True)
print(IndianFood)
else:
break
elif (ch==4):
while(True):
print(" ")
print("|4.Searchrecordsofagivencourse:dessert/maincourse/starter/snack|")
print(" ")
ch1=int(input("Enteryourchoice1-7")) if
(ch1==1):
data=input("EnternameoftheIndianFoodwhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.name==data])
elif(ch1==2):
data=input("Enternameofthestatewhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.state==data])
elif(ch1==3):
data=input("Enternameoftheregionwhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.region==data])
elif(ch1==4):
data=input("Enternameofthecoursewhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.course==data])
elif(ch1==5):
data=input("Enternameoftheflavorwhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.flavor_profile==data])
elif(ch1==6):
data=input("Enternameofthedietwhosedetailsaretobedisplayed")
print(IndianFood[IndianFood.diet==data])
else:
break
elif (ch==5):
while(True):
print(" ")
print("|7.Visualizepreparationtimeregion:East/West/North/Southwise
|")print("|8.Vi
sualizepreparationtimecourse:dessert/maincourse/starter/snackwise|") print("| 9.
print(" ")
ch1=int(input("Enteryourchoice1-11")) if
(ch1==1):
ab=IndianFood.state
cd=IndianFood.cook_time
plt.title("CookingTimeofIndiandishes")
plt.xlabel("Indian States")
plt.ylabel("Cooking Time")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="cook_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="cook_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==2):
ab=IndianFood.region
cd=IndianFood.cook_time
plt.title("CookingTimeofIndiandishes")
plt.xlabel("Regions")
plt.ylabel("CookingTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="cook_time")
plt.show()
elif(type==2):
plt.bar(ab,cd,label="cook_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==3):
ab=IndianFood.course
cd=IndianFood.cook_time
plt.title("CookingTimeofIndiandishes")
plt.xlabel("Course")
plt.ylabel("CookingTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="cook_time")
plt.show()
elif(type==2):
plt.bar(ab,cd,label="cook_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==4):
ab=IndianFood.flavor_profile
cd=IndianFood.cook_time
plt.title("CookingTimeofIndiandishes")
plt.xlabel("Flavors")
plt.ylabel("CookingTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="cook_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="cook_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==5):
ab=IndianFood.diet
cd=IndianFood.cook_time
plt.title("CookingTimeofIndiandishes")
plt.xlabel("Diet")
plt.ylabel("CookingTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2"))
if (type==1):
plt.plot(ab,cd,label="cook_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="cook_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==6):
ab=IndianFood.state
cd=IndianFood.prep_time
plt.title("PreparationTimeofIndiandishes")
plt.xlabel("Indian States")
plt.ylabel("Preparation Time")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
print("Select the type of chart")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="prep_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="prep_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==7):
ab=IndianFood.region
cd=IndianFood.prep_time
plt.title("PreparationTimeofIndiandishes")
plt.xlabel("Regions")
plt.ylabel("PreparationTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart |")
print("| 2. Bar Chart |")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="prep_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="prep_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==8):
ab=IndianFood.course
cd=IndianFood.prep_time
plt.title("PreparationTimeofIndiandishes")
plt.xlabel("Course")
plt.ylabel("PreparationTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="prep_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="prep_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==9):
ab=IndianFood.flavor_profile
cd=IndianFood.prep_time
plt.title("PreparationTimeofIndiandishes")
plt.xlabel("Flavors")
plt.ylabel("PreparationTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="prep_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="prep_time")
plt.show()
else:
print("Invalidchoice")
elif (ch1==10):
ab=IndianFood.diet
cd=IndianFood.prep_time
plt.title("PreparationTimeofIndiandishes")
plt.xlabel("Diet")
plt.ylabel("PreparationTime")
plt.xticks(rotation=30)
plt.grid(True)
print(" ")
print("|1.LineChart|")
print("|2.BarChart|")
print(" ")
type=int(input("Enterchoice1-2")) if
(type==1):
plt.plot(ab,cd,label="prep_time")
plt.show()
elif (type==2):
plt.bar(ab,cd,label="prep_time")
plt.show()
else:
print("Invalidchoice")
else:
break
elif (ch==6):
while(True):
print(" ")
print("|6.Exit |")
print(" ")
ch1=int(input("Enteryourchoice1-6")) if
(ch1==1):
stat=input("EnterState")
print(" ")
print(" ")
ch2=int(input("Enterchoice"))
if (ch2==1):
k=IndianFood.loc[IndianFood['state']==stat].cook_time
print(min(k))
elif (ch2==2):
k=IndianFood.loc[IndianFood['state']==stat].cook_time
print(max(k))
elif (ch2==3):
k=IndianFood.loc[IndianFood['state']==stat].index
print(len(k))
else:
print("Invalidchoice")
elif (ch1==2):
regi=input("EnterRegion")
print(" ")
print("|1.MinimumCookingTime |")print("|
print(" ")
ch2=int(input("Enterchoice"))
if (ch2==1):
k=IndianFood.loc[IndianFood['region']==regi].cook_time
print(min(k))
elif (ch2==2):
k=IndianFood.loc[IndianFood['region']==regi].cook_time
print(max(k))
elif(ch2==3):
k=IndianFood.loc[IndianFood['region']==regi].index
print(len(k))
else:
print("Invalidchoice")
elif (ch1==3):
cour=input("EnterCourse")
print(" ")
print(" ")
ch2=int(input("Enterchoice"))
if (ch2==1):
k=IndianFood.loc[IndianFood['course']==cour].cook_time
print(min(k))
elif (ch2==2):
k=IndianFood.loc[IndianFood['course']==cour].cook_time
print(max(k))
elif (ch2==3):
k=IndianFood.loc[IndianFood['course']==cour].index
print(len(k))
else:
print("Invalidchoice")
elif (ch1==4):
die=input("EnterDiet")
print(" ")
print(" ")
ch2=int(input("Enterchoice"))
if (ch2==1):
k=IndianFood.loc[IndianFood['diet']==die].cook_time
print(min(k))
elif (ch2==2):
k=IndianFood.loc[IndianFood['diet']==die].cook_time
print(max(k))
elif (ch2==3):
k=IndianFood.loc[IndianFood['diet']==die].index
print(len(k))
else:
print("Invalidchoice")
elif (ch1==5):
flavor=input("EnterFlavor")
print(" ")
print(" ")
ch2=int(input("Enterchoice"))
if (ch2==1):
k=IndianFood.loc[IndianFood['flavor_profile']==flavor].cook_time
print(min(k))
elif (ch2==2):
k=IndianFood.loc[IndianFood['flavor_profile']==flavor].cook_time
print(max(k))
elif (ch2==3):
k=IndianFood.loc[IndianFood['flavor_profile']==flavor].index
print(len(k))
else:
print("Invalidchoice")
else:
break
else:
print("aaaa")
break
rep=input("Doyouwanttostorethechangesdonepermanentlyy/n")
if (rep=="y" or rep=="Y"):
IndianFood.to_csv("IndianFood.csv")
print("Changessavedpermanently")
else:
print("Changesnotsaved")
OUTPUTSCREENSHOTS
.