Professional Documents
Culture Documents
DOC-20240716-WA0001
DOC-20240716-WA0001
Consider a DataFrame ‘df’ created using the dictionary given below, answer the questions
given below:
ii)
exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily','Michael','Matthew',
'Lara', 'Kevin', 'Jonas'],
'score': [12.5, 9, 16.5, np.NaN, 9, 20,14.5, np.NaN, 8, 19],
'attempts' : [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
qualify': ['yes','no','yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']}
i) Consider the above Data frame as df. Write a Python Code to calculate the average salary of the
Regular employees and the Contract employees separately.
ii) Write a Python Code to update the Salary of all Contract employees to Rs19000
iii) Write a Python Code to display the 4th Record.
iv) Write a Python Code to display the maximum salary of all employees in the ‘IT’ department.
20 Write a Python script to perform the following tasks: 5
• Create a DataFrame from a dictionary of lists with the following data:
data = {
’Student'. ['Alice', 'Bob’, 'Charlie', 'David', 'Eva'], ’Math'. [85, 92, 78, 90, 95],
'Science“. [88, 79, 84, 91, 89],
’English'. [92, 85, 88, 86, 94]
• Add a new column 'Total' which is the sum of'Math', 'Science', and 'English' for each student.
• Rename the columns 'Math' to 'Mathematics', 'Science' to 'Physics', and 'English'
to ’Literature'.
Filter out students who scored below 90 in 'Total'.