0% found this document useful (0 votes)
421 views

Employee Data Analysis IP Sample Project

The document describes an employee daya analysis system that imports pandas and matplotlib libraries. It reads employee data from a CSV file and offers various menu options to view, search, add, delete, modify employee records, and generate salary charts and graphs. The system updates and saves the employee data back to the CSV file.

Uploaded by

Stuartina Manuel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
421 views

Employee Data Analysis IP Sample Project

The document describes an employee daya analysis system that imports pandas and matplotlib libraries. It reads employee data from a CSV file and offers various menu options to view, search, add, delete, modify employee records, and generate salary charts and graphs. The system updates and saves the employee data back to the CSV file.

Uploaded by

Stuartina Manuel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

EMPLOYEE DAYA ANALYSIS SYSTEM

import pandas as pd
import matplotlib.pyplot as plt
ch='Y'
while ch=='Y':
print('1.Read esv file')
print('2.Show all records')
print('3.Show the name of female employees')
print('4.Search Record')
print('5.Add new record')
print('6.Delete record')
print('7.Modify record')
print('8.Show salry 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('emp.csv') #read the csv file
print('file opened')
elif choice==2:
print(df)
elif choice==3:
print(df[df['gender']=='F']['name'])
elif choice==4:
e=int(input('enter emp no to search'))
inx=df[df.empno==e].index.values #to get index value
if len(inx)==0:
print("record not found")
else:
print(df[df.empno==e])
elif choice==5:
e=int(input('Enter emp no\t'))
n=input('Enter name\t')
d=input('Enter dept\t')
s=int(input("Enter salary\t"))
g=input("Enter gender\t")
df=df.append({'empno':e,'name':n,
'dept':d,'gender':g,'salary':s},ignore_index=True)
print('record added')
elif choice==6:
e=int(input('enter emp no to delete'))
inx=df[df.empno==e].index.values
if len(inx)==0:
print("record not found")
else:
print(df[df.empno==e])
df=df[df['empno']!=e]
print('record deleted')
df.index=range(len(df)) #rearange index no
elif choice==7:
e==int(input('enter emp no to modify'))
inx=df[df.empno==e].index.values #to get index value
if len(inx)==0:
print('record not found')
else:
print(df[df.empno==e])
n=input('enter new name')
d=input('enter new dept')
s=int(input('enter new salary'))
g=input('enter new gender')
df.loc[inx,"name"]=n
df.loc[inx,"dept"]=d
df.loc[inx,"salary"]=s
df.loc[inx,"gender"]=g
print("record updated")
elif choice==8:
plt.ylabel('Salary')
plt.xlabel('Empno')
plt.plot(df['empno'],df['salary'])
plt.title('Salary Chart')
plt.show( )
elif choice==9:
plt.bar(df['name'],df['salary'])
plt.title('Salary Graph')
plt.xlabel('Names')
plt.ylabel('Salary')
plt.show( )
elif choice==10:
df.to_csv('emp.csv',index=False)
print('file saved')
ch=input('Do u want to continue').upper( )

CSV FILE
OUTPUT SCREENS
CHOICE 1
CHOICE 2
CHOICE 3

CHOICE 4
CHOICE 5

CHOICE 6
CHOICE 7
CHOICE 8
CHOICE 9

CHOICE 10

You might also like