• Home
  • Textbooks
  • CUET (UG) Question Bank Chapter-wise and Topic-wise General Test | For 2024 Exam
  • DATA HANDLING USING PANDAS-I

CUET (UG) Question Bank Chapter-wise and Topic-wise General Test | For 2024 Exam

Oswaal Editorial Board

Chapter 2

DATA HANDLING USING PANDAS-I - all with Video Answers

Educators


Section 1

[A] MULTIPLE CHOICE QUESTIONS

Problem 1

Write the output of the given statement on the basis of given Pandas series; " $s$ ".
[CUET 2022]
a 2
b 4
c 6
d 8
e 10
f $\quad 12$
$\operatorname{print}(s[: 3])$
(A) a 2
(B) a 2
(C) a 2
(D) $\mathrm{d} \quad 8$
b 4
b 4
b 4
e 10
c 6
c
f
12
d 8

Check back soon!

Problem 2

Which package/software is most suitable to create the CSV file?
[CUET 2022]
(A) Any word processing
(B) Any spreadsheet package
(C) Any Presentation package
(D) Any Database software

Check back soon!
03:18

Problem 3

Consider a dataframe 'df, which statement(s) is (are) incorrect w.r.t. df operations?
[CUET 2022]
A. dif'x' $][10,20,30]$, will add a new column'x' to dataframe df.
B. df.loc[ ' $x$ ']-[30,40,70], will add a new column'x' to dataframe $d$.
C. dfl'x'][10,20,30], will add a new row to the dataframe df.
D. df $\operatorname{loc}[\mathrm{x}]-[30,40,70]$, will always add a new row to the dataframe df.
E. df.drop( $x$, axis-0), will delete the row with label ' $x$ ' from the dataframe df.
Choose the correct answer from the options given below:
(A) B. C and D only
(B) A and E only
(C) B and E only
(D) C only

Niamat Khuda
Niamat Khuda
Numerade Educator
04:19

Problem 4

Ms. Bhavika wants to change the index of the dataframe and the output for the same is given below: [CUET 2022]
$$
\begin{array}{|l|l|l|}
\hline & \text { Name } & \text { Stream } \\
\hline \text { Student1 } & \text { ananya } & \text { humanities } \\
\hline \text { student2 } & \text { bhavya } & \text { humanities } \\
\hline
\end{array}
$$
Identify the correct statement to change the index.
(A) dl.index['student1', 'student2"]
(B) $\mathrm{d} 1$.index $[$ ['student1', 'student2"]
(C) $\mathrm{d} 1$.index [ 'student1", "student2"]
(D) dl.index = [ 'student1', 'student2"]

Srilakshmi E K
Srilakshmi E K
Numerade Educator

Problem 5

In data science for data analysis, which of the python library are more popular?
[CUET 2022]
(A) Swift
(B) Django
(C) Open office
(D) Pandas

Check back soon!
05:27

Problem 6

Find the output for following:
[CUET 2022]
import numpy as np
pencil np.array( $[10,20,30])$
eraser- np.array $([40,50,70])$
pen= np.array $([11,16,17,18])$
import pandas as pd
Stationary pd.DataFrame([pencil, pen, eraser], columns=['AB', 'CD', 'EF",'GH'])
print(Stationary)
$$
\begin{aligned}
&\text { (A) }\\
&\begin{array}{|l|l|l|l|l|}
\hline & \text { AB } & \text { CD } & \text { EF } & \text { GH } \\
\hline 0 & 10 & 20 & 30 & \mathrm{NaN} \\
\hline 1 & 11 & 16 & 17 & 18 \\
\hline 2 & 40 & 50 & 70 & \mathrm{NaN} \\
\hline
\end{array}
\end{aligned}
$$
$$
\begin{aligned}
&\text { (B) }\\
&\begin{array}{|l|l|l|l|l|}
\hline & \mathbf{A B} & \mathbf{C D} & \text { EF } & \text { GH } \\
\hline 0 & 10 & 20 & 30 & \text { No value } \\
\hline 1 & 11 & 16 & 17 & 18 \\
\hline 2 & 40 & 50 & 70 & \text { No value } \\
\hline
\end{array}
\end{aligned}
$$
$$
\begin{aligned}
&\text { (C) }\\
&\begin{array}{|l|l|l|l|l|}
\hline & \text { AB } & \text { CD } & \text { EF } & \text { GH } \\
\hline 0 & 10 & 20 & 30 & 0 \\
\hline 1 & 11 & 16 & 17 & 18 \\
\hline 2 & 40 & 50 & 70 & 0 \\
\hline
\end{array}
\end{aligned}
$$
$$
\begin{aligned}
&\text { (D) }\\
&\begin{array}{|l|l|l|l|l|}
\hline & \mathbf{A B} & \mathbf{C D} & \mathbf{E F} & \text { GH } \\
\hline 0 & 10 & 20 & 30 & - \\
\hline 1 & 11 & 16 & 17 & 18 \\
\hline 2 & 40 & 50 & 70 & - \\
\hline
\end{array}
\end{aligned}
$$

Rukhmani Jain
Rukhmani Jain
Numerade Educator

Problem 7

Which command is used for combining/merging dataframes in pandas?
[CUET 2022]
(A) pd.combine()
(B) pd.merge()
(C) pd.join()
(D) pd.show()

Check back soon!
02:23

Problem 8

'a', 'b',' c',' d', 'e'. Choose the correct statements to do the same. Assuming that Pandas library is already imported with object alias as pd and numpy as np.
[CUET 2022]
(A) pd.Series(np.arange( $2,12,2$ ), index = ['a', 'b','c', 'd', 'e'])
(B) pd.Series(np.range(2.12.2), index = ['a', 'b','c'.'d', 'e'])
(C) pd.Series(np.arange (2,10,2), index = [' $a$ ', 'b',' $c$ ', 'd', 'e'])
(D) pd.Series(pd.arange(2,12,2), index = ['a', 'b','c', 'd', 'e'])

John Piaszynski
John Piaszynski
Numerade Educator
02:33

Problem 9

Given a dataframe dl with columns name, stream and Roll no.
[CUET 2022]
Prabhat wants to print the details of Bhavya' along with stream. Identify the correct statement.
(A) print(d1[['name',[stream']] [d]1['name']=-'Bhavya'])
(B) $\operatorname{print}(\mathrm{d} 1[[$ 'name', 'stream']] [d['name']==Bhavya')
(C) $\operatorname{print}($ d1 $[[$ 'name']=-Bhavya'])
(D) $\operatorname{print}(\mathrm{d} 1[[$ 'name','stream'] [d1['name']='Bhavya'])

Varsha Aggarwal
Varsha Aggarwal
Numerade Educator

Problem 10

Match List I with List II
[CUET 2022]
Table Can't Copy
Choose the correct answer from the options given below:
(A) A-III ,B-II , C-I ,D-IV
(B) A-IV ,B-I ,C-II ,D-III
(C) A-III ,B-IV ,C-II ,D-I
(D) A-II ,B-I ,C-III ,D-IV

Check back soon!

Problem 11

Which Python library is not used for data science?
(A) Pandas
(B) Numpy
(C) Matplotlib
(D) Tkinter

Check back soon!

Problem 12

Given a Pandas series called sequences, the command which will display the first 4 rows is $\qquad$
(A) print (sequences.head(4))
(B) print (sequences.Head(4))
(C) print (sequences.heads(4))
(D) print (sequences.Heads(4))

Check back soon!

Problem 13

The command to install the Pandas is:
(A) Install pip pandas
(B) Install pandas
(C) pip pandas
(D) pip install pandas

Check back soon!
01:59

Problem 14

What will be the output of the given code?
import pandas as pd
$s=$ pd.Series([1,2,3,4,5],index=['akram','brijesh','charu','deepika','era'])
print(s['charu'])
(A) 1
(B) 2
(C) 3
(D) 4

Srilakshmi E K
Srilakshmi E K
Numerade Educator
01:13

Problem 15

Consider the following series named animal:
L Lion
E Elephant
W Wolf
Write the output of the command:
$$
\text { print(animal }[\because-3] \text { ) }
$$
(A) L Lion
T Tiger
dtype: object
(C) W Wolf
B Bear
dtype: object
B Bear
T Tiger
dtype: Object
(B) B Bear
E Elephant
dtype: object
(D) W Wolf
T Tiger
dtype: object

Manik Pulyani
Manik Pulyani
Numerade Educator

Problem 16

A social science teacher wants to use a pandas series to teach about Indian historical monuments and their states. The series should have the monument names as values and state names as indexes which are stored in the given lists, as shown in the code. Choose the statement which will create the series:
import pandas as pd
Monument=['Qutub Minar','Gateway of India', 'Red Fort','Taj Mahal'] State=['Delhi','Maharashtra','Delhi','Uttar Pradesh']
(A) $\mathrm{S}=$ df.Series(Monument,index $=$ State)
(B) $\mathrm{S}=$ pd.Series(State,Monument)
(C) $\mathrm{S}=$ pd.Series(Monument,index $=$ State)
(D) $\mathrm{S} \approx$ pd.series(Monument,index $=$ State)

Check back soon!
01:05

Problem 17

Which of the following statement is wrong?
(A) Can't change the index of the Series.
(B) We can easily convert the list, tuple, and dictionary into a series.
(C) A Series represents a single column in memory.
(D) We can create empty Series

James Kiss
James Kiss
Numerade Educator
01:03

Problem 18

What type of error is returned by the following statement? import pandas as pa pa.Series $([1,2,3,4]$, index $=[$ ' $a$ ', 'b', 'c'])
(A) Value Error
(B) Syntax Error
(C) Name Error
(D) Logical Error

Vysakh M
Vysakh M
Numerade Educator

Problem 19

Consider the following Series in Python: data $=$ pd.Series $\left([5,2,3,7]\right.$, index $=\left[{ }^{\prime} a\right.$ ', 'b', 'c', 'd'])
Which Statement will display all odd values?
(A) $\operatorname{print}($ data $\% 2=0)$
(B) $\operatorname{print}($ data $($ data $\% 2!=0))$
(C) print(data mod $2!=0$ )
(D) $\operatorname{print}($ data $[$ data $\% 2!=0])$

Check back soon!
01:13

Problem 20

To display third element of a Series object $S$, you will write:
(A) $\mathrm{S}[: 3]$
(B) $\mathrm{S}[2]$
(C) $\mathrm{S}[3]$
(D) $\mathrm{S}[: 2]$

Nidhi Singhi
Nidhi Singhi
Numerade Educator