CBSE BOARD XII, asked by ashwin20030509, 3 months ago

Consider the following DataFrame df and answer any four questions from (i)-(v)
EMPID CATEGORY SALARY
E01 CLERK 20000
E02 MANAGER 50000
E03 RECEPTIONIST 35000
E04 CLERK 25000
E05 DIRECTOR 80000

) Write down the command that will give the following output :-
EMPID CATEGORY SALARY
0 E01 CLERK 20000
1 E02 MANAGER 50000
2 E03 RECEPTIONIST 35000
(a). df.head(2)
(b) df.head( )
(c.) df.head(3)
(d) df.Head(3)
1
Write down the command that will give the following output :


ii)
EMPID SALARY
0 E01 20000
1 E02 50000
2 E03 35000
3 E04 25000
4 E05 80000
(a) df.loc(:,:)
(b) df.loc[:,[0,2]]
(c.) df.iloc[:,[0:3]]
(d) df.iloc[:,[0,2]]

iii) Write down the command that will give the following output :-
EMPID CATEGORY SALARY
0 E01 CLERK 20000
2 E03 RECEPTIONIST 35000
3 E04 CLERK 25000
4 E05 DIRECTOR 80000
a.) df.drop()
b.) df.drop(2)
c.) df.head(4)
d.) df.drop(1)

iv) What output will be produced by the following command :-
df.rename(columns={‘EMPID’:'EID','CATEGORY':'CAT'})
(a)
EID CATEGORY SALARY
0 E01 CLERK 20000
1 E02 MANAGER 50000
2 E03 RECEPTIONIST 35000
3 E04 CLERK 25000
4 E05 DIRECTOR 80000
1Page 5 of
11
(b)
EID CAT
0 E01 20000
1 E02 50000
2 E03 35000
3 E04 25000
4 E05 80000
(c.)
EID CAT SALARY
0 E01 CLERK 20000
1 E02 MANAGER 50000
2 E03 RECEPTIONIST 35000
3 E04 CLERK 25000
4 E05 DIRECTOR 80000
(d.) None of the above

v) Mr. Aiyer, wants to add a new column – ‘ENAME’ with values, ‘R’, ‘X’, ‘A’, ‘D’, ‘F’ to the
DataFrame. Help him choose the command to do so:
a.) df.column=[‘R’, ‘X’, ‘A’, ‘D’, ‘F’]
b.) df [‘ENAME’]=[ ‘R’, ‘X’, ‘A’, ‘D’, ‘F’]
c. ) df.loc[‘ENAME’]= [‘R’, ‘X’, ‘A’, ‘D’, ‘F’]
d.) Both (b) and (c) are correct

Answers

Answered by surajky21
0

Answer:

land se khelenge bathroom me aja

Similar questions