0% found this document useful (0 votes)
358 views11 pages

Employee Data Analysis System

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
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)
358 views11 pages

Employee Data Analysis System

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
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

EMPLOYEE DAYA ANALYSIS SYSTEM

import pandas as pd
import [Link] as plt
ch='Y'
while ch=='Y':
print('[Link] esv file')
print('[Link] all records')
print('[Link] the name of female employees')
print('[Link] Record')
print('[Link] new record')
print('[Link] record')
print('[Link] record')
print('[Link] salry chart using line graph')
print('[Link] salary chart using bar graph')
print('[Link] data into csv file')
choice=int(input('enter your choice :'))
if choice==1:
df=pd.read_csv('[Link]') #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[[Link]==e].[Link] #to get index value
if len(inx)==0:
print("record not found")
else:
print(df[[Link]==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=[Link]({'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[[Link]==e].[Link]
if len(inx)==0:
print("record not found")
else:
print(df[[Link]==e])
df=df[df['empno']!=e]
print('record deleted')
[Link]=range(len(df)) #rearange index no
elif choice==7:
e==int(input('enter emp no to modify'))
inx=df[[Link]==e].[Link] #to get index value
if len(inx)==0:
print('record not found')
else:
print(df[[Link]==e])
n=input('enter new name')
d=input('enter new dept')
s=int(input('enter new salary'))
g=input('enter new gender')
[Link][inx,"name"]=n
[Link][inx,"dept"]=d
[Link][inx,"salary"]=s
[Link][inx,"gender"]=g
print("record updated")
elif choice==8:
[Link]('Salary')
[Link]('Empno')
[Link](df['empno'],df['salary'])
[Link]('Salary Chart')
[Link]( )
elif choice==9:
[Link](df['name'],df['salary'])
[Link]('Salary Graph')
[Link]('Names')
[Link]('Salary')
[Link]( )
elif choice==10:
df.to_csv('[Link]',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

Common questions

Powered by AI

The user interface interactions primarily include a menu-driven system where users select from options to perform operations such as reading a CSV file, displaying records, filtering by gender, searching, adding, deleting, modifying records, visualizing data through graphs, and saving the dataset. The 'input' function gathers necessary information from the user, illustrating a basic yet essential interactive element for data manipulation .

To maintain data integrity, the system automatically updates and rearranges the index values of the dataframe whenever records are added or deleted. This ensures that each record has a consistent index value and that the overall dataset remains ordered and free of gaps in index numbering .

The system allows modification of employee records by prompting the user to enter the employee number of the record they wish to modify. It then retrieves the index value of this record. If the record is found, the system enables the user to input new values for the employee's name, department, salary, and gender, updating the record accordingly at the identified index .

The system saves modified data by using the pandas 'to_csv' function. It writes the current data of the dataframe to an 'emp.csv' file and sets the 'index' parameter to False to exclude index values from the output file, ensuring that only the data content is saved .

The system filters and displays gender-specific data by selecting records where the gender column matches 'F' for female employees. It then outputs the names of those female employees, allowing for focused analysis of gender-specific data within the dataset .

To add a new employee record, the system requires inputs for employee number, name, department, salary, and gender from the user. It appends this new record as a dictionary to the existing dataframe, using the 'ignore_index' parameter set to True to ensure a unique index for the new record .

The system offers basic visualization options limited to line and bar graphs, which may not adequately convey complex data insights such as employee demographics or performance metrics over time. The absence of other visualization types, like pie charts or histograms, might limit deeper analysis of categorical variables or distribution patterns in salary data .

The system checks the presence of a record by its employee number before deletion. If the record is not found, it outputs 'record not found'; otherwise, it deletes the record. After successful deletion, it rearranges the indices of the remaining records to ensure data integrity .

The system prompts the user to input an employee number to search for an associated record. It then uses the employee number to find the index of this record within the dataset. If no matching index is found, the system outputs 'record not found'; otherwise, it displays the employee's record details .

The system offers two methods for visual representing salary data: a line graph, which plots salary against employee number, and a bar graph, which displays salary against employee names. In both cases, the graphs display salary as a function of another variable, helping to visualize trends and comparisons in the employee dataset .

You might also like