Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views2 pages

Gopal Project Code

The Python script for the Gopal Project allows users to manage a CSV file containing Netflix program data. Users can read, display, search, add, delete, modify records, and visualize salary data using line and bar graphs. The script includes a loop for continuous interaction until the user chooses to exit.

Uploaded by

tpass7716
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)
12 views2 pages

Gopal Project Code

The Python script for the Gopal Project allows users to manage a CSV file containing Netflix program data. Users can read, display, search, add, delete, modify records, and visualize salary data using line and bar graphs. The script includes a loop for continuous interaction until the user chooses to exit.

Uploaded by

tpass7716
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/ 2

Python Script - Gopal Project

import pandas as pd
import matplotlib.pyplot as pl
ch='Y'
while ch=='Y':
print('1.Read CSV File')
print('2.Show All Records')
print('3.Show The Director Name Of Cobra Kai')
print('4.Search Record')
print('5.Add New Record')
print('6.Delete Record')
print('7.Modify Record')
print('8.Show Salary Chart Using Line Graph')
print('9.Show Salary Chart Using Bar Graph')
print('10.Save Data Into CSV File')
choice=int(input('Enter Your Choice:'))

if choice==1:
df = pd.read_csv('Gopal Project.csv') # updated file name
print('File Opened')

elif choice==2:
print(df)

elif choice==3:
print(df[df['Director_name']=='Josh Heald'])

elif choice==4:
e=int(input('Enter Netflix ID to search'))
inx=df[df.Netflix_Id==e].index.values # to get index value
if len(inx)==0:
print("Record Not Found")
else:
print(df[df.Netflix_Id==e])

elif choice==5:
n=int(input('Enter Netflix ID'))
p=input('Enter Programme Name')
ns=input('Enter Number Of Seasons')
d=input('Enter Director Name')
a=input('Enter Actor Name')
an=input('Enter Actress Name')
ap=int(input('Enter Amount Paid'))
df=df._append({'Netflix_Id':n,'Programme Name':p,'No_Of_Seasons':ns,'Director_name':d,'Act

elif choice==6:
e=int(input('Enter Netflix ID To Delete'))
inx=df[df.Netflix_Id==e].index.values
if len(inx)==0:
print('Record Not Found')
else:
print(df[df.Netflix_Id==e])
df=df[df['Netflix_Id']!=e]
print('Record Deleted')
df.index=range(len(df))

elif choice==7:
e=int(input('Enter Netflix ID To Modify'))
inx=df[df.Netflix_Id==e].index.values
if len(inx)==0:
print("Record Not Found")
else:
print(df[df.Netflix_Id==e])
n=input('Enter New Netflix ID')
p=input('Enter New Programme Name')
ns=int(input("Enter New Number Of Seasons"))
d=input("Enter New Director Name")
a=input("Enter New Actor Name")
an=input("Enter New Actress Name")
ap=input("Enter New Amount Paid")
df.loc[inx,"Netflix_id"]=n
df.loc[inx,"Programme Name"]=p
df.loc[inx,"No_Of_Seasons"]=ns
df.loc[inx,"Director_name"]=d
df.loc[inx,"Actor_Name"]=a
df.loc[inx,"Actress_Name"]=an
df.loc[inx,"Amount_Paid"]=ap
print("Record Updated")

elif choice==8:
pl.ylabel('Number Of Seasons')
pl.xlabel('Programme Name')
pl.plot(df['Programme Name'],df['No_Of_Seasons'])
pl.title('Total Seasons')
pl.show()

elif choice==9:
pl.bar(df['Actor_Name'],df['Amount_Paid'])
pl.title('Salary Graph')
pl.xlabel('Names')
pl.show()

elif choice==10:
df.to_csv('Gopal Project.csv', index=False) # updated file name
print('File Saved')
ch=input(' Do You Want To Continue ').upper()

You might also like