Consider the following DataFrame emp and answer the any four questions from (i) to (v) 5
Empno |
Name |
Dept |
Salary |
Experience (in years) |
1 |
Ram Singh |
IT |
15000 |
2.5 |
2 |
Shyam Singh |
HR |
18000 |
3 |
3 |
Nidhi Gupta |
IT |
9000 |
2 |
4 |
Pooja Sharma |
EXE |
24000 |
8 |
5 |
Rohan Malik |
HR |
20000 |
6 |
(i) Write down the command that will give the following output.
Empno 5
Name Rohan Malik
Dept HR
Salary 20000
Experience 6
dtype: object
a. print(emp.max)
b. print(emp.max())
c. print(emp.max(axis=1))
d. print(emp.max,axis=1)
(ii) CEO needs to know the salary of the employee with empno 4. Help him to identify the correct set of statement/s from the given options:
a. emp1=emp[emp[‘empno’]==4] print(emp1)
b. emp1=emp[emp] print(emp1)
c. emp1=emp[emp.empno=4] print(emp1)
d. emp1=emp[emp.empno==4] print(emp1)
(iii) Which of the following statement/s will give the exact number of values in each column of the dataframe?
i. print(emp.count())
ii. print(emp.count(0))
iii. print(emp.count)
iv. print(emp.count(axis=’index’))
Choose the correct option:
a. both (i) and(ii)
b. only(ii)
c. (i), (ii) and(iii)
d. (i), (ii) and(iv)
(iv) Which of the following command will display the column labels of the DataFrame?
a. print(emp.columns())
b. print(emp.column())
c. print(emp.column)
d. print(emp.columns)
(v) Mr. Satvik Ahuja, the CEO wants to add a new column, the rating of the performance of employees with the values, ‘A’, ‘A’, ‘B’, ‘A’, ‘B’, to the DataFrame. Help him choose the command to do so:
a. emp.column=[’A’,’A’,’B’,’A’,’B’]
b. emp[‘Performance’]=[ ’A’,’A’,’B’,’A’,’B’]
c. emp.loc[‘Performance’]= [’A’,’A’,’B’,’A’,’B’]
d. Both (b) and (c) are correct