TEST : CSV FILE
1. Write the advantages of CSV file?
2. How the following are different?
a. CSV file and Text File
b. "a" and "w" file modes
c. writer( ) and reader( ) functions
3. Surya is a manager working in a recruitment agency. He needs to manage the records
of various candidates. For this, he wants the following information of each candidate
to be stored in csv file "Candidate.csv": -
Candidate_ID – integer
Candidate_Name – string
Designation – string
Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
a. Write a function to input the data of a candidate and append it in a CSV file.
b. Write a function to read the data from the CSV file and display the data of all
those candidates whose Experience is more than 10 years and Designation is
"Clerk"
c. Write a function to remove the detail of the candidate whose Candidate ID is
passed as parameter
4. Create a function MAXSALARY( ) in Python to read all the records from an already
existing file record.csv which stores the records of various employees working in a
department. Data is stored under various fields as shown below:
E_code E_name Scale Salary
A01 Bijesh Mehra S4 65400
B02 Vikram Goel S3 60000
C09 Suraj Mehta S2 45300
…… …… …… ……
Function should display the row where the salary is maximum.
Note: Assume that all employees have distinct salary.
5. A csv file "Happiness.csv" contains the data of a survey. Each record of the file
contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that country)
● Happy (Number of persons who accepted that they were Happy)
For example, a sample record of the file may be: [‘Signiland’, 5673000, 5000, 3426]
Write the following Python functions to perform the specified operations on this file: .
a) Read all the data from the file in the form of a list and display all those records for
which the population is more than 5000000.
b) Count the number of records in the file.