IP Py Project
IP Py Project
In
INFORMATICS PRACTICES
Aryan Pandey
XII A
Contents
S no Title sign
1. Introduction of the
Project.
2. CSV File (Data)
3. Python Coding.
5. Future Scope
6. System Requirements of
the Project.
7. References.
Introduction of
the project
The Election Seats Management System is a project developed to
manage and streamline the process of election seat allocation in
various constituencies. The system is designed to simplify the
handling of election results, including the assignment of seats to
candidates based on votes received.
main_menu()
# PROGRAM NUMBER 01 = Read complete CSV file
def ReadCSV() :
print("Reading data form CSV file")
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv")
df=df.dropna()
print (df)
def no_index():
print("Reading data from CSV file without index value")
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv",index_col=0)
print(df)
def update_col():
df = pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv")
print(" Enter 1 to update BJP seats")
print(" Enter 2 to update INC seats")
print(" Enter 3 to update OTHERS seats")
op = int(input("enter your choice:"))
x = int(input("enter state no"))
y = int(input("enter the value"))
if op==1:
df.loc[(x - 1), 'BJP'] = y
df.to_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv", index=False)
print(df)
elif op ==2:
df.loc[(x - 1), 'INC'] = y
df.to_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv", index=False)
print(df)
elif op ==3:
df.loc[(x - 1), 'OTHERS'] = y
df.to_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv", index=False)
print(df)
else:
print("enter valid input")
def data_Sorting():
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv")
elif op==2:
df.sort_values(["BJP"],inplace=True)
print(df)
elif op==3:
df.sort_values(["INC"],inplace=True)
print(df)
elif op==4:
df.sort_values(["OTHERS"],inplace=True)
print(df)
else:
print("Enter Valid input")
def specific_col():
print("Reading specific column from CSV file")
print("Enter 1 to show BJP seats")
print("Enter 2 to show INC seats")
print("Enter 3 to show OTHERS seats")
if op==1:
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv",usecols=['state','BJ
P'],index_col=0)
print(df)
elif op==2:
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv",usecols=['state','IN
C'],index_col=0)
print(df)
elif op==3:
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv",usecols=['state','O
THERS'],index_col=0)
print(df)
else:
print("Enter valid input")
# PROGRAM NUMBER 09 = Read Top and Bottom record from file as per requirment
def top_bottom_selected_records():
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv", index_col=0)
top=int( input("How many records to display from top: "))
print("First", top, "records")
print(df. head (top))
bottom=int(input ("How many records to display from bottom: "))
print("Last", bottom, "records")
print(df. tail (bottom))
def line_plot():
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv")
df = df.astype({"state": str})
st=df['state']
p1=df['BJP']
p2=df['INC']
p3=df['OTHERS']
plt.xlabel("State")
plt.xticks(rotation='vertical')
if op == 1:
plt.ylabel("BJP")
plt.title("State wise BJP seats")
plt.plot(st,p1)
plt.show()
elif op==2:
plt.ylabel("INC")
plt.title("State wise INC seats")
plt.plot(st,p2)
plt.show()
elif op==3 :
plt.ylabel("OTHERS")
plt.title("Statewise other seats")
plt.plot(st,p3)
plt.show()
elif op==4 :
plt.ylabel("Number of seats")
plt.plot(st,p1,label="State wise BJP seats")
plt.plot(st,p2,label="State wise INC seats")
plt.plot(st,p3,label="State wise OTHER seats")
plt.legend()
plt.show()
else:
print("ENTER VALID INPUT")
def bar_plot():
df=pd.read_csv(r"C:\Users\Acer\Desktop\sonit\Election.csv")
df = df.astype({"state": str})
st=df["state"]
p1=df['BJP']
p2=df['INC']
p3=df['OTHERS']
plt.xlabel("State")
plt.xticks(rotation='vertical')
if op==1 :
plt.ylabel("BJP")
plt.title("State wise BJP seats")
plt.bar(st,p1)
plt.show()
elif op==2:
plt.ylabel("INC")
plt.title("State wise INC seats")
plt.bar(st,p2)
plt.show()
elif op==3:
plt.ylabel("OTHERS")
plt.title("State wise OTHERS seats")
plt.bar(st,p3)
plt.show()
elif op==4:
plt.ylabel("Number of seats")
plt.bar(st,p1,width=0.2,label="State wise BJP seats")
plt.bar(st,p2,width=0.2,label="State wise INC seats")
plt.bar(st,p3,width=0.2,label="State wise OTHERS seats")
plt.legend()
plt.show()
elif op==5:
mcu=np.arange(len(st))
width=0.25
plt.bar(mcu,p1,width,label="State wise BJP seats")
plt.bar(mcu+0.25,p2,width,label="State wise INC seats")
plt.bar(mcu+0.5,p3,width,label="State wise OTHERS seats")
plt.legend()
plt.show()
else:
print("Enter Valid input")
else:
print("Enter Valide input")
OUTPUT OF THE PROJECT
MAIN INTERFACE
Read complete CSV file
Reading complete file without index
Search Specific Data
Insert the new Row
Update the specific columns
BJP seats
Read the specific columns
INC seats
Read the specific columns
OTHERS seats
Read Top and Bottom record from file as per
requirement
Make the copy of CSV file
Line Chart
• With future technology the precision and accuracy of the data will
get more enhanced & We can easily access the data with without
much difficulties.
• For the security purpose password and login system will be added in
it in future.
System Requirements of
theProject
2.Python.org
3.Code academy
4. Google python class
5.Learnpython.org