Q1.
|
In
Pandas _______________ is used to store data in
multiple columns. a. Series b. DataFrame c. Both of the above d. None of the above Ans. b.
DataFrame |
|
||||||||||||||||||||||||||||||
Q2.
|
A _______________ is a two-dimensional labelled data
structure . a. DataFrame b. Series c. List d. None of the above Ans.
a. DataFrame |
|
||||||||||||||||||||||||||||||
Q3.
|
.
_____________ data Structure has both a row and column
index. a. List b. Series c. DataFrame d. None of the above Ans. c.
DataFrame |
|
||||||||||||||||||||||||||||||
Q4.
|
Which
library is to be imported for creating DataFrame? a. Python b. DataFrame c. Pandas d. Random Ans. c.
Pandas |
|
||||||||||||||||||||||||||||||
Q5.
|
Which
of the following function is used to create DataFrame? a. DataFrame( ) b. NewFrame( ) c. CreateDataFrame( ) d. None of the Above Ans.
a. DataFrame( ) |
|
||||||||||||||||||||||||||||||
Q6.
|
The
following code create a dataframe named ‘D1’ with _______________ columns. import pandas as pd a. 1 b. 2 c. 3 d. 4 Ans. a.
1 |
|
||||||||||||||||||||||||||||||
Q7.
|
We
can create DataFrame from _____ a. Numpy arrays b. List of Dictionaries c. Dictionary of Lists d. All of the above Ans. d.
All of the above |
|
||||||||||||||||||||||||||||||
Q8.
|
Which of the following is used to
give user defined column index in DataFrame? a. index b. column c. columns d. colindex Ans. c.
columns |
|
||||||||||||||||||||||||||||||
Q9.
|
The
following code create a dataframe named ‘D1’ with ___________ columns. import pandas as pd a. 1 b. 2 c. 3 d. 4 Ans. c. 3 |
|
||||||||||||||||||||||||||||||
Q10.
|
The
following code create a dataframe named ‘D1’ with ______ rows. import pandas as pd a. 0 b. 1 c. 2 d. 3 Ans.
c. 2 |
|
||||||||||||||||||||||||||||||
Q11.
|
When
we create DataFrame from List of Dictionaries, then dictionary keys will
become ____________ a. Column labels b. Row labels c. Both of the above d. None of the above Ans. a.
Column labels |
|
||||||||||||||||||||||||||||||
Q12.
|
When
we create DataFrame from List of Dictionaries, then number of columns in
DataFrame is equal to the _______ a. maximum number of keys in first
dictionary of the list b. maximum number of different keys
in all dictionaries of the list c. maximum number of dictionaries in
the list d. None of the above Ans. b.
maximum number of different keys in all dictionaries of the list |
|
||||||||||||||||||||||||||||||
Q13.
|
When
we create DataFrame from List of Dictionaries, then number of rows in
DataFrame is equal to the ____________ a. maximum number of keys in first
dictionary of the list b. maximum number of keys in any
dictionary of the list c. number of dictionaries in the list d. None of the above Ans. c.
number of dictionaries in the list |
|
||||||||||||||||||||||||||||||
Q14.
|
In
given code dataframe ‘D1’ has ________ rows and _______ columns. import pandas as pd a. 3, 3 b. 3, 4 c. 3, 5 d. None of the above Ans. c.
3, 5 |
|
||||||||||||||||||||||||||||||
Q15.
|
When
we create DataFrame from Dictionary of List then Keys becomes the _____________ a. Row Labels b. Column Labels c. Both of the above d. None of the above Ans. b.
Column Labels |
|
||||||||||||||||||||||||||||||
Q16.
|
When
we create DataFrame from Dictionary of List then List becomes the ________________ a. Row Labels b. Column Labels c. Values of rows d. None of the above Ans. c.
Values of rows |
|
||||||||||||||||||||||||||||||
Q17.
|
In
given code dataframe ‘D1’ has _____ rows and ______ columns. import pandas as pd a. 3, 3 b. 3, 2 c. 2, 3 d. None of the above Ans. b.
3, 2 |
|
||||||||||||||||||||||||||||||
Q18.
|
We can create a DataFrame using a
single series. (T/F) a. True b. False Ans. a.
True |
|
||||||||||||||||||||||||||||||
Q19.
|
DataFrame
created from single Series has ____ column. a. 1 b. 2 c. n (Where n is the number of
elements in the Series) d. None of the above Ans. a.
1 |
|
||||||||||||||||||||||||||||||
Q20.
|
In
given code dataframe ‘D1’ has _____ rows and _____ columns. import pandas as pd S1 = pd.Series([1, 2, 3, 4], index = ['a',
'b','c','d']) S2 = pd.Series([11, 22, 33, 44], index = ['a',
'bb','c','dd']) D1 = pd.DataFrame([S1,S2]) a. 2, 4 b. 4, 6 c. 4, 4 d. 2, 6 Ans. d.
2, 6 |
|
||||||||||||||||||||||||||||||
Q21.
|
In
DataFrame, by default new column added as the _____________ column a. First (Left Side) b. Second c. Last (Right Side) d. Random Ans. c.
Last (Right Side) |
|
||||||||||||||||||||||||||||||
Q22.
|
We
can add a new row to a DataFrame using the _____________ method a. rloc[ ] b. iloc[ ] c. loc[ ] d. None of the above Ans. c.
loc[ ] |
|
||||||||||||||||||||||||||||||
Q23.
|
D1[
: ] = 77 , will set __________ values
of a Data Frame ‘D1’ to 77. a. Only First Row b. Only First Column c. All d. None of the above Ans. c.
All |
|
||||||||||||||||||||||||||||||
Q24.
|
In the following statement, if
column ‘Rollno’ already exists in the DataFrame ‘D1’ then the assignment
statement will _____________ D1['Rollno'] = [1,2,3] #There are only three rows
in DataFrame D1' a. Return error b. Replace the already existing
values. c. Add new column d. None of the above Ans. b.
Replace the already existing values. |
|
||||||||||||||||||||||||||||||
Q25.
|
In the following statement, if
column ‘Rollno’ already exists in the DataFrame ‘D1’ then the assignment
statement will __________ D1['Rollno'] = [1, 2] #There are only three rows
in DataFrame D1' a. Return error b. Replace the already existing
values. c. Add new column d. None of the above Ans. a.
Return error |
|
||||||||||||||||||||||||||||||
Q26.
|
In the following statement, if
column ‘Rollno’ already exists in the DataFrame ‘D1’ then the assignment
statement will __________ D1['Rollno'] = 11 a. Return error b. Change all values of column Roll
numbers to 11 c. Add new column d. None of the above Ans. b.
Change all values of column Roll numbers to 11 |
|
||||||||||||||||||||||||||||||
Q27.
|
DF1.loc[
] method is used to ______ # DF1
is a DataFrame a. Add new row in a DataFrame ‘DF1’ b. To change the data values of a row
to a particular value c. Both of the above d. None of the above Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q28.
|
Which method is used to delete row
or column in DataFrame? a. delete( ) b. del( ) c. drop( ) d. None of the above Ans. c.
drop( ) |
|
||||||||||||||||||||||||||||||
Q29.
|
To
delete a row, the parameter axis of function drop( ) is assigned the
value ______________ a. 0 b. 1 c. 2 d. 3 Ans. a.
0 |
|
||||||||||||||||||||||||||||||
Q30.
|
To
delete a column, the parameter axis of function drop( ) is assigned the
value _____________ a. 0 b. 1 c. 2 d. 3 Ans. b.
1 |
|
||||||||||||||||||||||||||||||
Q31.
|
The
following statement will _________ df = df.drop(['Name', 'Class', 'Rollno'], axis =
1) #df is a DataFrame object a. delete three columns having labels
‘Name’, ‘Class’ and ‘Rollno’ b. delete three rows having labels
‘Name’, ‘Class’ and ‘Rollno’ c. delete any three columns d. return error Ans. a.
delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’ |
|
||||||||||||||||||||||||||||||
Q32.
|
If
the DataFrame has more than one row with the same label, then DataFrame.drop(
) method will delete _____ a. first matching row from it. b. all the matching rows from it c. last matching row from it. d. Return Error Ans. b.
all the matching rows from it |
|
||||||||||||||||||||||||||||||
Q33.
|
Write the code to remove duplicate
row labelled as ‘R1’ from DataFrame ‘DF1’ a. DF1 = DF1.drop(‘R1’, axis = 0) b. DF1 = DF1.drop(‘R1’, axis = 1) c. DF1 = DF1.del(‘R1’, axis = 0) d. DF1 = DF1.del(‘R1’, axis = 1) Ans. a.
DF1 = DF1.drop(‘R1’, axis = 0) |
|
||||||||||||||||||||||||||||||
Q34.
|
Which method is used to change the
labels of rows and columns in DataFrame? a. change( ) b. rename( ) c. replace( ) d. None of the above Ans.
b. rename( ) |
|
||||||||||||||||||||||||||||||
Q35.
|
The
parameter axis=’index’ of rename( ) function is used to specify that
the ________ a. row and column label is to be changed b. column label is to be changed c. row label is to be changed d. None of the above Ans. c.
row label is to be changed |
|
||||||||||||||||||||||||||||||
Q36.
|
What will happen if in the rename(
) function we pass only a value for a row label that does not exist? a. it returns an error. b. matching row label will not change
. c. the existing row label will left
as it is. d. None of the above Ans. c.
the existing row label will left as it is. |
|
||||||||||||||||||||||||||||||
Q37.
|
What value should be given to axis
parameter of rename function to alter column name? a. column b. columns c. index d. None of the above Ans. b.
columns |
|
||||||||||||||||||||||||||||||
Q38.
|
The
following statement is __________ >>>
DF=DF.rename({‘Maths’:’Sub1′,‘Science’:’Sub2′}, axis=’index’) #DF is a
DataFrame a. altering the row labels b. altering the column labels c. altering the row and column labels
(both) d. Error Ans. a.
altering the row labels |
|
||||||||||||||||||||||||||||||
Q39.
|
Write a statement to delete column
labelled as ‘R1’ of DataFrame ‘DF’.. a. DF= DF.drop(‘R1’, axis=0) b. DF= DF.del(‘R1’, axis=0) c. DF= DF.drop(‘R1’, axis=0, row =
‘duplicate’) d. None of the above Ans. d.
None of the above |
|
||||||||||||||||||||||||||||||
Q40.
|
Which of the following parameter is
used to specify row or column in rename function of DataFrame? a. rowindex b. colindex c. Both of the above d. index Ans. d.
index |
|
||||||||||||||||||||||||||||||
Q41.
|
Which of the following are ways of
indexing to access Data elements in a DataFrame? a. Label based indexing b. Boolean Indexing c. All of the above d. None of the above Ans. c.
All of the above |
|
||||||||||||||||||||||||||||||
Q42.
|
DataFrame.loc[
] is an important method that is used for ____________ with
DataFrames a. Label based indexing b. Boolean based indexing c. Both of the above d. None of the above Ans. a.
Label based indexing |
|
||||||||||||||||||||||||||||||
Q43.
|
The
following statement will return the column as a _______ >>> DF.loc[: , 'Name'] #DF is a
DataFrame object a. DataFrame b. Series c. List d. Tuple Ans. b.
Series |
|
||||||||||||||||||||||||||||||
Q44.
|
The
following two statement will return _______________ >>> DF.loc[:,'Name'] #DF is a DataFrame
object a. Same Output b. Name column of DataFrame DF c. Both of the above d. Different Output Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q45.
|
The
following statement will display ________ rows
of DataFrame ‘DF’ print(df.loc[[True, False,True]]) a. 1 b. 2 c. 3 d. 4 Ans.
b. 2 |
|
||||||||||||||||||||||||||||||
Q46.
|
We
can use the ______ method to merge two
DataFrames a. merge( ) b. join( ) c. append( ) d. drop( ) Ans. c.
append( ) |
|
||||||||||||||||||||||||||||||
Q47.
|
We can merge/join only those DataFrames
which have same number of columns.(T/F) a. True b. False Ans. b.
False |
|
||||||||||||||||||||||||||||||
Q48.
|
What we are doing in the following
statement? dF1=dF1.append(dF2) #dF1 and dF2 are DataFrame
object a. We are appending dF1 in dF2 b. We are appending dF2 in dF1 c. We are creating Series from
DataFrame d. None of the above Ans. b.
We are appending dF2 in dF1 |
|
||||||||||||||||||||||||||||||
Q49.
|
. ______________ parameter is used in append( )
function of DataFrame to get the column labels in sorted order. a. sorted b. sorter c. sort d. None of the above Ans. c.
sort |
|
||||||||||||||||||||||||||||||
Q50.
|
. ________ parameter of append( ) method may be
set to True when we want to raise an error if the row labels are duplicate. a. verify_integrity b. verifyintegrity c. verify.integrity d. None of the above Ans. a.
verify_integrity |
|
||||||||||||||||||||||||||||||
Q51.
|
The ________________parameter of
append() method in DataFrame may be set to True, when we do not want to use
row index labels. a. ignore_index_val b. ignore_index_value c. ignore_index d. None of the above Ans.
c. ignore_index |
|
||||||||||||||||||||||||||||||
Q52.
|
The append() method of DataFrame
can also be used to append ____________to a DataFrame a. Series b. Dictionary c. Both of the above d. None of the above Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q53.
|
Which of the following attribute of
DataFrame is used to display row labels? a. columns b. index c. dtypes d. values Ans. b.
index |
|
||||||||||||||||||||||||||||||
Q54.
|
Which of the following attribute of
DataFrame is used to display column labels? a. columns b. index c. dtypes d. values Ans. a.
columns |
|
||||||||||||||||||||||||||||||
Q55.
|
Which of the following attribute of
DataFrame is used to display data type of each column in DataFrame? a. Dtypes b. DTypes c. dtypes d. datatypes Ans. c.
dtypes |
|
||||||||||||||||||||||||||||||
Q56.
|
Which of the following attribute of
DataFrame display all the values from DataFrame? a. values b. Values c. val d. Val Ans. a.
values |
|
||||||||||||||||||||||||||||||
Q57.
|
Which of the following attribute of
DataFrame display the dimension of DataFrame a. shape b. size c. dimension d. values Ans. a.
shape |
|
||||||||||||||||||||||||||||||
Q58.
|
If
the following statement return (5, 3) it means _____ >>> DF.shape #DF is a
DataFrame object a. DataFrame DF has 3 rows 5 columns b. DataFrame DF has 5 rows 3 columns c. DataFrame DF has 3 rows 5
rowlabels d. None of the above Ans. b.
DataFrame DF has 5 rows 3 columns |
|
||||||||||||||||||||||||||||||
Q59.
|
Transpose
the DataFrame means _____________ a. Row indices and column labels of
the DataFrame replace each other’s position b. Doubling the number of rows in
DataFrame c. Both of the above d. None of the above Ans. a.
Row indices and column labels of the DataFrame replace each other’s position |
|
||||||||||||||||||||||||||||||
Q60.
|
Which of the following is used to
display first 2 rows of DataFrame ‘DF’? a. DF.head( ) b. DF.header(2) c. DF.head(2) d. None of the above Ans. c.
DF.head(2) |
|
||||||||||||||||||||||||||||||
Q61.
|
Which of the following statement is
Transposing the DataFrame ‘DF1’? a. DF1.transpose b. DF1.T c. DF1.Trans d. DF1.t Ans. b.
DF1.T |
|
||||||||||||||||||||||||||||||
Q62.
|
Following
statement will display ___________ rows
from DataFrame ‘DF1’. >>> DF1.head() a. All b. 2 c. 3 d. 5 Ans. d.
5 |
|
||||||||||||||||||||||||||||||
Q63.
|
Which of the following function
display the last ‘n’ rows from the DataFrame? a. head( ) b. tail( ) c. Tail( ) d. None of the above Ans. b.
tail( ) |
|
||||||||||||||||||||||||||||||
Q64.
|
Which property of dataframe is used
to check that dataframe is empty or not? a. isempty b. IsEmpty c. empty d. Empty Ans. c.
empty |
|
||||||||||||||||||||||||||||||
Q65.
|
Write the output of the statement
>>>df.shape , if df has the following structure. Name Class Rollno 0
Amit 6 1 1
Anil 7 2 2
Ravi 8 3 a. (3, 4) b. (4, 3) c. (3, 3) d. None of the above Ans. c.
(3, 3) |
|
||||||||||||||||||||||||||||||
Q66.
|
Write the output of the statement
>>>df.size , if df has the following structure: Name Class Rollno 0
Amit 6 1 1
Anil 7 2 2
Ravi 8 3 a. 9 b. 12 c. 6 d. None of the above Ans. a.
9 |
|
||||||||||||||||||||||||||||||
Q67.
|
Write the output of the statement
>>>df.empty , if df has the following structure: Name Class Rollno 0
Amit 6 1 1
Anil 7 2 2
Ravi 8 3 a. True b. False c. Yes d. None of the above Ans. b.
False |
|
||||||||||||||||||||||||||||||
Q68.
|
Parameters
of read_csv( ) function is _____ a. sep b. header c. Both of the above d. None of the above Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q69.
|
Which of the following function is
used to load the data from the CSV file into a DataFrame? a. read.csv( ) b. readcsv( ) c. read_csv( ) d. Read_csv( ) Ans. c.
read_csv( ) |
|
||||||||||||||||||||||||||||||
Q70.
|
The
default value for sep parameter is _________ a. comma b. semicolon c. space d. None of the above Ans. c.
space |
|
||||||||||||||||||||||||||||||
Q71.
|
Write statement to display the row
labels of ‘DF’. a. DF.Index b. DF.index( ) c. DF.index d. DF.row_index Ans. c.
DF.index |
|
||||||||||||||||||||||||||||||
Q72.
|
Write statement to display the
column labels of DataFrame ‘DF’ a. DF.Column b. DF.column c. DF.columns d. DF.Columns Ans. c.
DF.columns |
|
||||||||||||||||||||||||||||||
Q73.
|
Display first row of dataframe ‘DF’ a. print(DF.head(1)) b. print(DF[0 : 1]) c. print(DF.iloc[0 : 1]) d. All of the above Ans. d.
All of the above |
|
||||||||||||||||||||||||||||||
Q74.
|
Display last two rows from
dataframe ‘DF’ a. print(DF[-2 : -1]) b. print(DF.iloc[-2 : -1]) c. print(DF.tail(2)) d. All of the above Ans. c.
print(DF.tail(2)) |
|
||||||||||||||||||||||||||||||
Q75.
|
Write statement to display the data
types of each column of dataframe ‘DF’. a. DF.types( ) b. DF.dtypes c. DF.dtypes( ) d. None of the above Ans. b.
DF.dtypes |
|
||||||||||||||||||||||||||||||
Q76.
|
Write statement to display the
dimension of dataframe ‘DF’. a. DF.dim b. DF.ndim c. DF.dim( ) d. None of the above Ans. b.
DF.ndim |
|
||||||||||||||||||||||||||||||
Q77.
|
Write statement to transpose
dataframe DF. a. DF.T b. DF.transpose c. DF.t d. DF.T( ) Ans. a.
DF.T |
|
||||||||||||||||||||||||||||||
Q78.
|
Write statement to display first
two columns of dataframe ‘DF’. a. DF[DF.columns[ 0 : 2 ] ] b. DF.columns[ 0 : 2 ] c. Both of the above d. None of the above Ans. a.
DF[DF.columns[ 0 : 2 ] ] |
|
||||||||||||||||||||||||||||||
Q79.
|
Write statement to display the
shape of dataframe ‘DF’. a. DF.Shape b. DF.shape c. DF.shapes d. DF.Shapes Ans. b.
DF.shape |
|
||||||||||||||||||||||||||||||
Q80.
|
Write a statement to Check if DF is
empty or it contains data. a. DF.Empty b. DF.empty( ) c. DF.empty d. None of the above Ans. c.
DF.empty |
|
||||||||||||||||||||||||||||||
Consider the DataFrame ‘DF’ given
below and answer the questions from Q81 to Q90. Following DataFrame ‘DF’
containing year wise sales figures for five sales persons
Python DataFrame ‘DF’ |
||||||||||||||||||||||||||||||||
Q81.
|
Write a statement to append the
DataFrame ‘DF2’ to the DataFrame ‘DF’ a. DF.append(DF2) b. DF2.append(DF) c. DF2.update(DF) d. None of the above Ans. a.
DF.append(DF2) |
|
||||||||||||||||||||||||||||||
Q82.
|
Write a statement to display the
sales made by all sales persons in the year 2017. a. print(DF.loc[: , 2017]) b. print(DF[2017]) c. Both of the above d. None of the above Ans.
print(DF.loc[2017]) |
|
||||||||||||||||||||||||||||||
Q83.
|
Write a statement to add new column
for another year ‘2018’ with values 55000, 65000, 75000, 85000, 95000 a. DF[2018] = 55000, 65000, 75000,
85000, 95000 b. DF[2018] = [55000, 65000, 75000,
85000, 95000] c. DF[2018] = (55000, 65000, 75000,
85000, 95000) d. All of the above Ans. d.
All of the above |
|
||||||||||||||||||||||||||||||
Q84.
|
Write a statement to add new row
for ‘Raman’ with values 55000, 66000, 77000, 88000 a. DF.loc[‘Raman’] = 55000, 66000,
77000, 88000 b. DF.loc[‘Raman’] = [55000, 66000,
77000, 88000] c. Both of the above d. None of the above Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q85.
|
Raman was caught in the case of
cheating so his Boss decided to set his sales of all years to 0(Zero). Help
him to write the code for same. a. DF.loc[‘Raman’] = {0} b. DF.loc[‘Raman’] = [0] c. DF.loc[‘Raman’] = 0 d. All of the above Ans. c.
DF.loc[‘Raman’] = 0 |
|
||||||||||||||||||||||||||||||
Q86.
|
Write a statement to delete the
record of ‘Shruti’ a. print(DF.drop(‘Shruti’,axis=0)) b. print(DF.drop(‘Shruti’)) c. both of the above d. none of the above Ans. c.
both of the above |
|
||||||||||||||||||||||||||||||
Q87.
|
Write a statement to delete a
column having column label as 2017. a. print(DF.drop(2017,axis=0)) b. print(DF.drop(2017,axis=1)) c. print(DF.drop(‘2017’,axis=1)) d. All of the above Ans. b.
print(DF.drop(2017,axis=1)) |
|
||||||||||||||||||||||||||||||
Q88.
|
Write a statement to delete two
columns having column label as 2017 and 2016 a. print(DF.drop([2017, 2016],
axis=1)) b. print(DF.drop((2017, 2016),
axis=1)) c. Both of the above d. print(DF.drop([2017,2016],axis=0)) Ans. a.
print(DF.drop([2017, 2016], axis=1)) |
|
||||||||||||||||||||||||||||||
Q89.
|
Replace the row label ‘Ankit’ with
‘Ankita’ in dataframe ‘DF’ a. DF.Rename({‘Ankit’ : ‘Ankita’}) b. DF.rename({‘Ankit’ : ‘Ankita’}) c. DF.repalce({‘Ankit’:’Ankita’}) d. None of the above Ans. b.
DF.rename({‘Ankit’ : ‘Ankita’}) |
|
||||||||||||||||||||||||||||||
Q90.
|
Replace the column label from 2016
to 2020. a. DF.rename({2016 : 2020}, axis =
‘columns’) b. DF.rename({2016 : 2020}, axis =
‘index’) c. DF.rename({2016 : 2020}, axis =
‘column’) d. DF.rename({2016 : 2020}, axis =
columns) Ans. a.
DF.rename({2016 : 2020},axis = ‘columns’) |
|
||||||||||||||||||||||||||||||
Consider the DataFrame ‘DF’ given
below and answer the questions from Q91 to Q100. Following DataFrame ‘DF’
containing marks of five students in three subjects.
Python DataFrame |
||||||||||||||||||||||||||||||||
Q91.
|
Display the marks of Harry in Maths
Subject. a. print(DF.loc[‘Maths’, ‘Harry’]) b. print(DF.Loc[‘Maths’, ‘Harry’]) c. print(DF.loc(‘Maths’, ‘Harry’)) d. None of the above Ans. a.
DF.loc[‘Maths’, ‘Harry’] |
|
||||||||||||||||||||||||||||||
Q92.
|
Display the marks of Karan in all
Subjects a. print(DF.loc[‘Science’ :
‘English’, ‘Karan’]) b. print(DF[‘Karan’]) c. Both of the above d. None of the above Ans. c.
Both of the above |
|
||||||||||||||||||||||||||||||
Q93.
|
Display marks of Karan and Rounaq
in Maths and Science a. print(DF.loc[‘Science’ : ‘Maths’,
‘Karan’ : ‘Rounaq’]) b. print(DF.loc[‘Science’ : ‘Maths’,
[‘Karan’ : ‘Rounaq’]]) c. Both of the above d. None of the above Ans. a.
print(DF.loc[‘Science’ : ‘Maths’, ‘Karan’ : ‘Rounaq’]) |
|
||||||||||||||||||||||||||||||
Q94.
|
Display marks of all students in
Maths and Science. a. print(DF.loc[‘Maths’ : ‘Science’]) b. print(DF.loc[‘Science’ : ‘Maths’]) c. Both of the above d. None of the above Ans. b.
print(DF.loc[‘Science’ : ‘Maths’]) |
|
||||||||||||||||||||||||||||||
Q95.
|
Write a statement to check that in
which subject kiran scored more than 90. a. DF.loc[ : , ‘Kiran’] >= 90 b. DF.loc[:, ‘Kiran’] < 90 c. DF.loc[: , ‘Kiran’] > 90 d. None of the above Ans. c.
DF.loc[: , ‘Kiran’] > 90 |
|
||||||||||||||||||||||||||||||
Q96.
|
Write a statement to rename the
subject ‘Maths’ to ‘Mathematics’ a. DF.ren({“Maths” : “Mathematics”}) b. DF.Rename({“Maths”:”Mathematics”}) c. DF.rename({“Maths”:”Mathematics”}) d. DF.replace({“Maths”:”Mathematics”}) Ans. c.
DF.rename({“Maths”:”Mathematics”}) |
|
||||||||||||||||||||||||||||||
Q97.
|
Write a statement to remove column
labelled as ‘Harry’ a. print(DF.drop(‘Harry’, axis = 0)) b. print(DF.drop(‘Harry’, axis = 1)) c. Both of the above d. None of the above Ans. b.
print(DF.drop(‘Harry’, axis = 1)) |
|
||||||||||||||||||||||||||||||
Q98.
|
Write a statement to increase five
marks of all students in all subjects. a. DF[ : ] = DF[ : ]+5 b. DF[ : ] = DF[ : ]+[5] c. Both of the above d. None of the above Ans. a.
DF[ : ] = DF[ : ]+5 |
|
||||||||||||||||||||||||||||||
Q99.
|
Write a statement to add new column
labelled ‘Ruby’ with values 85, 75, 79. a. DF[Ruby]=[85, 75, 79] b. DF[‘Ruby’] = [85, 75, 79] c. DF[‘Ruby’=[85,75,79]] d. None of the above Ans. b.
DF[‘Ruby’] = [85, 75, 79] |
|
||||||||||||||||||||||||||||||
Q100.
|
Write a statement to increase marks
of ‘Anuj’ in ‘Maths’ Subject by 10. a. DF.loc[‘Maths’,
‘Anuj’]=DF.loc[‘Maths’, ‘Anuj’]+10 b. DF.loc[‘Anuj’, ‘Maths’]=DF.loc[‘Maths’, ‘Anuj’]+10 c. DF.loc[‘Anuj’,
‘Maths’]=DF.loc[‘Anuj’, ‘Maths’]+10 d. None of the above Ans. a.
DF.loc[‘Maths’, ‘Anuj’]=DF.loc[‘Maths’, ‘Anuj’]+10 |
|
"Python Tutorial". Welcome to my blog contains material for students studying Python at Class XI & XII (CBSE) for Computer Science and Informatics Practices.
Wednesday, 8 September 2021
MCQ DataFrame-II
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment