Font size
WorksheetsPython Pandas Quiz Class 12
Total questions: 146
Worksheet time: 1hrs 16mins
In a DataFrame, axis-0 is for
Columns
Rows and Columns both
Rows
None of these
To get the Transpose of a DataFrame D1, you can write _____________.
D1.T
D1.Transpose
D1.swap
All of these
To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe DF, you can write ________.
DF.loc[6:9, 3:5]
DF.loc[6:10, 3:6]
DF.iloc[6:10, 3:6]
DF.iloc[6:9, 3:5]
Which among the following can be used to create a DataFrame in Pandas?
A scalar value
An ndarray
A python dictionary
All of these
To delete a row from a DataFrame, you may use the __________ statement.
remove
delete
drop
cancel
You have a Pandas dataframe (assigned to the variable df) with the given data. Which of the following code snippets will return the temperature and rainfall of rows 2 and 3?
df[['temperature','rainfall']][1:3]
df['temperature', 'rainfall'][1:3]
df.iloc[1:3]
df.iloc[1:3,1:2]
Select the most suitable option. Statement I: A DataFrame is size mutable. Statement II: A series cannot contain duplicate indexes.
I is False and II is True
I is True and II is True
I is False and II is False
I is True and II is False
Which of the following is correct Features of DataFrame?
Potentially columns are of different types
Can Perform Arithmetic operations on rows and columns
Labeled axes (rows and columns)
All of the above
Specify the statement which can be given using row labels and column labels in order to display the sales performance in Qtr3 of year Y2016.
df.at[Qtr3, Y2016]
df.at['Qtr3', 'Y2016']
df.iat[2,1]
df.iat['Qtr3', 'Y2016']
Specify the statement which can be given using row labels and column labels in order to display the sales performance in the quarters – Qtr1 and Qtr3 of years - Y2017 and Y2018.
df.at[['Qtr1','Qtr3'], ['Y2017','Y2018']]
df.loc[['Qtr1','Qtr3'], ['Y2017','Y2018']]
df.loc['Qtr1','Qtr3', 'Y2017','Y2018']
df.iloc[['Qtr1','Qtr3'], ['Y2017','Y2018']]
Which point is correct in relation to 'at' and 'iat' attributes of a DataFrame object:
'at' attribute uses a row label and a column label to access a particular value whereas 'iat' uses a row index and a column index to access a single value.
'at' attribute uses a row index and a column index to access a particular value whereas 'iat' uses a row label and a column label to access a single value.
'at' attribute uses row labels and column labels to access multiple values whereas 'iat' uses row indices and column indices to access multiple values.
'at' attribute uses row indices and column indices to access multiple values whereas 'iat' uses row labels and column labels to access multiple values.
Consider the DataFramedf. Identify the statement to access rows from row no.2 to end and with all columns.
df.iloc[2: , :]
df.iloc[2:3, 0:1]
df.iloc[:,0:1]
df.iloc[0:3, 0:2]
Identify the function to iterate horizontally over a dataframe-
access()
iterrows()
loc()
iteritems()
Write the command to import Pandas library with the name pd-
import pandas as pd
import panda as pd
import Pandas as pd
Import Pandas as pd
Consider the DataFrame in question no. 5 and identify the statement to access the columns Population, Avg. Income and Per Capita Income for all rows-
df.iloc[0:4, 0:4]
df.loc[:, 'Population':'Per Capita Income']
df.loc[:, 'Population','Avg.Income', 'Per Capita Income']
df.iloc[0:3, 0,1,2]
Consider the DataFrame in question no. 5 and Identify the statement to calculate the total entries in Density column-
Density.count()
df.Density.count()
df.count('Density')
df['Density'].count()
Consider the DataFrame in question no. 5 and identify the statement to calculate the max value for the columns Population and Per Capita Income.
df.max('Population','Per Capita Income')
df.max(['Population','Per Capita Income'])
df.('Population','Per Capita Income').max()
df[['Population','Per Capita Income']].max()
This technique rearranges the data in ascending or descending order.
Sorting
Grouping
Pivoting
Piping
Select the command to change the name of city from Chennai to Madras-
df.rename('Chennai'='Madras',axis=0)
df.reindex(3='Madras')
df.rename({'Chennai':'Madras'}, axis=0)
df.rename(['Chennai':'Madras'], axis=0)
Identify correct statement(s)
If index is passed, then the length of the index should equal to the length of the arrays.
All the ndarrays must not be of same length
If no index is passed, then by default, index will be range(n), where n is the array length.
1 and 3 are correct
DataFrame is ______________
2D list
2D Array
1D Array
None
Consider the following DataFrame. Which is the right command to delete Age column from DataFrame Name Age Department Charges Gender
df.drop('Age')
df.pop('Age')
df.drop('Age',axis=1)
b and c are correct
a and b are correct
df1.columns will return
indexes of DataFrame
Column headings of DataFrame
Column index of DataFrame
None of the above
In X=pd.DataFrame(Y) , Y may be
List, Numpy Arrays
Dictionary
Series, DataFrame
Any of the Above
The Indices of a DataFrame can be of numbers or letters or strings
True
False
When we pass list of dictionary to create a DataFrame. The dictionary keys are by default taken as column names.
True
False
Consider the following DataFrameDF.What the following statement is doing :- DF['Retired']=['Y','N','N','N,'N',','N','N','N']
"Invalid Key " Error
Will add a new blank Column
Will add column Retired with specified data
Will Add a new row
Which is not an attribute of DataFrame Object
dtype
index
size
ndim
x=pd.DataFrame() What will be the value of x after executing this code
x is a dataframe which contains 0 in it
x is a dataframe which contains 1 in it
x is an Empty Dataframe
Error
after executing this code, what is x?
x is a dataframe which contains 0 in it
x is a dataframe which contains 1 in it
x is an Empty Dataframe
Error
Given the dataframe. How to extract details of piyush and krati?
df.iloc['piyush':'krati']
df.loc['piyush':'krati']
df.at['piyush':'krati']
df.iat['piyush':'krati']
Given the following dataframe. How to add a new column of total, which is sum of eng, hist and geog?
df{'total'}=df['eng'+'hist'+'geog']
df['total']=df['eng'+'hist'+'geog']
df['total']=df['eng']+df['hist']+df['geog']
df['total']=df['eng' : 'geog']
Given the dataframe. How to see marks of hritik in the subject - english and history?
df.loc['hritik','eng','hist']
df.loc['hritik','eng':'hist']
df.loc['hritik',['eng':'hist']]
df.loc[['hritik'],['eng':'hist']]
Given the following dataframe. How to extract marks of eng and geog?
df['eng','geog']
df[['eng'], ['geog']]
df['eng' : 'geog']
df[['eng','geog']]
There is no difference between a NumPy array and a Series object.
True
False
To access values using row labels you can use DF._____
at
loc
iloc
iat
Given the dataframe. How to add details of a new student (name-shambhavi, marks in 3 subjects are 25, 50, 75 and total is 150)
df.add('shambhavi', 25, 50, 75, 150)
df.loc['shambhavi']={25, 50, 75, 150}
df.loc['shambhavi']=[25, 50, 75, 150]
df['shambhavi']=[25, 50, 75, 150]
The axis 1 identifies a dataframe's
rows
columns
values
datatype
Consider the DataFrame, namely Sdf , given below and answer any four questions out of the five (i) to (v): DataFrame: Sdf StudentID Homework Midterm Project Final 0 4560 100 97 100 95 1 5540 85 90 88 90 2 6889 92 85 88 87 3 6817 65 85 87 89 i) Which of the following commands will give the output as shown below? 5540 85 6889 92 6817 65
Sdf.loc[1: , :2]
Sdf.loc[0: , :2]
Sdf.iloc[0: , :2]
Sdf.iloc[1: , :2]
Display only the first two columns of the dataframe
Sdf.loc[:,:2]
Sdf.loc[:,:-2]
Sdf.iloc[:,:-2]
Sdf.iloc[:,:2]
The Principal wants to know the details of students who have scored at least 90% in the final Marks percentage. Which of the following set of commands will yield the desired result?
print(Sdf['Final'>=90])
print(Sdf[Sdf['Final']>=90])
tmp=(Sdf[[Sdf['Final']>=90] print(tmp)
print(Sdf['Final']>=90)
The programmer wants to calculate how many student’s details are stored in the dataframe. Which of the following commands will yield the number of records in each column of the dataframe.
Sdf.count(axis=1)
pandas.count(Sdf.columns)
Sdf.count()
pandas.count(Sdf)
What will the following statement yield? Sdf.Midterm>90
Consider the dataframe DATA as shown adjacent. Using the dataframe data, answer the following i) Which statement will delete rows with labels ‘Apple’ and ‘Lime’.
DATA.drop(['Apple','Lime'])
DATA.remove(['Apple','Lime'])
DATA.drop(['Apple','Lime'], axis=1)
DATA.remove(['Apple','Lime'], axis=1)
Write statement to delete columns with labels ‘Color’ and ‘Count’.
DATA.drop(['Color','Count'], axis=1)
DATA.drop(['Color','Count'])
DATA.drop(['Color','Count'], axis=0)
DATA.drop('Color','Count', axis=1)
In pandas, the function is used to check for null values in a DataFrame is _________
null
isnull
null( )
isnull( )
Consider the DataFramedf and answer any four questions from (i) to (v) Name Age score 0 Raj 25 80 1 Vimal 20 90 2 Rojin 23 100 3 Mithin 28 75 4 Don 26 85 i) To change the score of Mithin to 85
df.score[3]=85
df[‘Mithin’][3]=85
df[3]=85
df[‘Mithin’]=85
To display the minimum score from the DataFramedf
df.min()
df[min()]
df [‘score’].min()
df [‘score’].min
To add a new column match with the values[10,8,13,23,22]
df.'match'=[10,8,13,23,22]
df.column=[10,8,13,23,22]
df.match=[10,8,13,23,22]
df['match']=[10,8,13,23,22]
Which of the following command will give the column labels
df.columns
df.column
df[column]
df.columns()
To get the number of elements in a dataframe, _________ attribute may be used.
size
shape
values
datatype
To access values using row labels you can use DF________
loc( )
iloc( )
at( )
iat( )
In Pandas the function used to delete a column in a DataFrame is
remove
del
drop
cancel
Consider the following DataFramedf and answer any four questions from (i) to (v) City MaxTemp MinTemp RainFall Delhi 40 32 24.1 Bengaluru 31 25 36.2 Chennai 35 27 40.8 Mumbai 29 21 35.2 Kolkata 39 23 41.8 i) Which of the following command will display sum of every column of the data frame.
print(df.sum(axis=1))
print(df.sum(axis=column))
print(df.sum( ).axis=1)
print(df.sum( ))
Which of the following command will not display maximum of column RainFall?
print(df['RainFall'].max( ))
print(df.RainFall.max( ))
print(df.loc[:,['RainFall']].max( ))
print(df.loc['RainFall'].max( ))
Which of the following command will not display sum of MaxTemp, RainFall for first 5 rows?
print(df.loc[0:5, ["MaxTemp","RainFall"].sum( ))
print(df.loc[0:5, 1:3].sum( ))
print(df.iloc[0:5, [1,3]].sum( ))
print(df.iloc[0:5, [-3,-1]].sum( ))
Which of the following command will display Minimum value of the MaxTemp column?
df.loc['MaxTemp'].min( )
df.loc.'MaxTemp'.min( )
df['MaxTemp'].min( )
df[:,'MaxTemp'].min( )
Write down the command that will give the following output city Mumbai MaxTemp 40 MinTemp 32 RainFall 41.8 dtype:object
print(df.max)
print(df.max( ))
print(df.max(axis=1))
print(df.max, axis=1)
Consider the following DataFramedf and answer any four questions from (i) to (v) import pandas as pd data = {'name': ['James', 'Anna', 'Janet', 'Yogi', 'Robin', 'Amal', 'Mohan'], 'city': ['Mexico City', 'Toronto', 'Prague', 'Shanghai','Manchester', 'Cairo', 'Osaka'], 'age': [41, 28, 33, 34, 38, 31, 37], 'score': [88.0, 79.0, 81.0, 80.0, 68.0, 61.0, 84.0]} row_labels = [101, 102, 103, 104, 105, 106, 107] df = pd.DataFrame(data=data, index=row_labels) print(df) i) Display the city of all the students.
print(df['city'])
print(df.city)
print(df.iloc[:,1])
print(df.iloc[:,0])
Display the city, age and score of all the students.
print(df('city','age','score'()
print(df.iloc[1:4])
print(df[['city','age','score']])
print(df.iloc[:,1:4])
Display the details of the student 103.
print(df.loc[103,1])
print(df.loc[103])
print(df.loc[103,:])
print(df.iloc[2,:])
Display the details of the students 104 to 107.
print(df.loc[104:107])
print(df.iloc[3:])
print(df.iloc[104:107])
print(df.loc[3:])
Display the city in which Robin lives.
print(df.city[105])
print(df.iloc[‘Robin’])
print(df.iloc[4,1:2])
print(df.city[‘Robin’])
d (iv) d) Only (iv) v) Display the city in which Robin lives. i) print(df.city[105]) ii) print(df.iloc[‘Robin’]) iii) print(df.iloc[4,1:2]) iv) print(df.city[‘Robin’]) Choose the correct statement
(i),(iii),(iv)
Both (i) and (iii)
Both(ii) and (iii)
All of the above
Write code statements to list the following, from a dataframe namely sales. i) List only columns ‘item’ and ‘Revenue’.
print(sales[item, Revenue])
print(sales[[item, Revenue]])
print(sales[['item', 'Revenue']])
print(sales.'item', sales.'Revenue')
ii) List rows from 3 to 7.
print(sales.iloc[3:7])
print(sales.iloc[3:8])
print(sales.loc[3:7])
print(sales.loc[3:8])
iii) List the value of cell in 5th row and, ‘item’ column.
print(sales.loc[5,'item'])
sales.iloc[5,'item'])
sales.loc(5,'item')
sales.iloc(5,'item')
Mr. Ramesh want to rename the columns in the data frame DF itself. Which of the following attribute is useful for Mr. Ramesh?
inoriginal
inplace
indataframe
rename
D1[ : ] = 77 , will set __________ values of a Data Frame 'D1' to 77.
Only First Row
Only First Column
All
None of the above
In given code dataframe ‘D1’ has ________ rows and _______ columns. import pandas as pd LoD = [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20},{‘a’:7, ‘d’:10, ‘e’:20}] D1 = pd.DataFrame(LoD)
3, 3
3, 4
3, 5
None of the above
In Pandas _______________ is used to store data in multiple columns.
Series
DataFrame
Both of the above
None of the above
A _______________ is a two-dimensional labelled data structure.
DataFrame
Series
List
None of the above
_____________ data Structure has both a row and column index.
List
Series
DataFrame
None of the above
Which library is to be imported for creating DataFrame?
Python
DataFrame
Pandas
Random
Which of the following function is used to create DataFrame?
DataFrame( )
NewFrame( )
CreateDataFrame( )
None of the Above
We can create DataFrame from _____
Numpy arrays
List of Dictionaries
Dictionary of Lists
All of the above
Which of the following is used to give user defined column index in DataFrame?
index
column
columns
colindex
The following code create a dataframe named ‘D1’ with _______________ columns. import pandas as pd D1 = pd.DataFrame([1,2,3] )
1
2
3
4
The following code create a dataframe named ‘D1’ with ___________ columns. import pandas as pd LoD = [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20}] D1 = pd.DataFrame(LoD)
1
2
3
4
The following code create a dataframe named ‘D1’ with ______ rows. import pandas as pd LoD = [{'a':10, 'b':20}, {'a':5, 'b':10, 'c':20}] D1 = pd.DataFrame(LoD)
0
1
2
3
When we create DataFrame from List of Dictionaries, then dictionary keys will become ____________
Column labels
Row labels
Both of the above
None of the above
When we create DataFrame from List of Dictionaries, then number of columns in DataFrame is equal to the _______
maximum number of keys in first dictionary of the list
maximum number of different keys in all dictionaries of the list
maximum number of dictionaries in the list
None of the above
When we create DataFrame from Dictionary of List then List becomes the ________________
Row Labels
Column Labels
Values of rows
None of the above
When we create DataFrame from Dictionary of List then Keys becomes the _____________
Row Labels
Column Labels
Both of the above
None of the above
When we create DataFrame from List of Dictionaries, then number of rows in DataFrame is equal to the ____________
maximum number of keys in first dictionary of the list
maximum number of keys in any dictionary of the list
number of dictionaries in the list
None of the above
In given code dataframe ‘D1’ has ________ rows and _______ columns. import pandas as pd LoD = [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20},{‘a’:7, ‘d’:10, ‘e’:20}] D1 = pd.DataFrame(LoD)
3, 3
3, 4
3, 5
None of the above
In given code dataframe ‘D1’ has _____ rows and ______ columns. import pandas as pd LoD = {“Name” : [“Amit”, “Anil”,”Ravi”], “RollNo” : [1,2,3]} D1 = pd.DataFrame(LoD)
3, 3
3, 2
2, 3
None of the above
DataFrame created from single Series has ____ column.
1
2
n (Where n is the number of elements in the Series)
None of the above
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])
2, 4
4, 6
4, 4
2, 6
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'
Return error
Replace the already existing values.
Add new column
None of the above
In DataFrame, by default new column added as the _____________ column
First (Left Side)
Second
Last (Right Side)
Random
We can create a DataFrame using a single series.
True
False
We can add a new row to a DataFrame using the _____________ method
rloc[ ]
iloc[ ]
loc[ ]
None of the above
D1[ : ] = 77 , will set __________ values of a Data Frame ‘D1’ to 77.
Only First Row
Only First Column
All
None of the above
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'
Return error
Replace the already existing values.
Add new column
None of the above
In the following statement, if column ‘Rollno’ already exists in the DataFrame ‘D1’ then the assignment statement will __________ D1['Rollno'] = 11
Return error
Change all values of column Roll numbers to 11
Add new column
None of the above
DF1.loc[ ] method is used to ______ # DF1 is a DataFrame
Add new row in a DataFrame ‘DF1’
To change the data values of a row to a particular value
Both of the above
None of the above
Which method is used to delete row or column in DataFrame?
delete( )
del( )
drop( )
None of the above
To delete a row, the parameter axis of function drop( ) is assigned the value ______________
0
1
2
3
To delete a column, the parameter axis of function drop( ) is assigned the value _____________
0
1
2
3
The following statement will _________ df = df.drop(['Name', 'Class', 'Rollno'], axis = 1) #df is a DataFrame object
delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’
delete three rows having labels ‘Name’, ‘Class’ and ‘Rollno’
delete any three columns
return error
If the DataFrame has more than one row with the same label, then DataFrame.drop( ) method will delete _____
first matching row from it.
all the matching rows from it
last matching row from it.
Return Error
Write the code to remove duplicate row labelled as ‘R1’ from DataFrame ‘DF1’
DF1 = DF1.drop(‘R1’, axis = 0)
DF1 = DF1.drop(‘R1’, axis = 1)
DF1 = DF1.del(‘R1’, axis = 0)
DF1 = DF1.del(‘R1’, axis = 1)
remove duplicate row labelled as ‘R1’ from DataFrame ‘DF1’
DF1 = DF1.drop(‘R1’, axis = 0)
DF1 = DF1.drop(‘R1’, axis = 1)
DF1 = DF1.del(‘R1’, axis = 0)
DF1 = DF1.del(‘R1’, axis = 1)
Which method is used to change the labels of rows and columns in DataFrame?
change( )
rename( )
replace( )
None of the above
The parameter axis=’index’ of rename( ) function is used to specify that the ________
row and column label is to be changed
column label is to be changed
row label is to be changed
None of the above
What will happen if in the rename( ) function we pass only a value for a row label that does not exist?
it returns an error.
matching row label will not change .
the existing row label will left as it is.
None of the above
What value should be given to axis parameter of rename function to alter column name?
column
columns
index
None of the above
The following statement is __________ DF=DF.rename({‘Maths’:’Sub1′,‘Science’:’Sub2′}, axis=’index’) #DF is a DataFrame
altering the row labels
altering the column labels
altering the row and column labels (both)
Error
Write a statement to delete column labelled as ‘R1’ of DataFrame ‘DF’..
DF= DF.drop(‘R1’, axis=0)
DF= DF.del(‘R1’, axis=0)
DF= DF.drop(‘R1’, axis=0, row = ‘duplicate’)
None of the above
Which of the following parameter is used to specify row or column in rename function of DataFrame?
rowindex
colindex
Both of the above
index
Which of the following are ways of indexing to access Data elements in a DataFrame?
Label based indexing
Boolean Indexing
All of the above
None of the above
DataFrame.loc[ ] is an important method that is used for ____________ with DataFrames
Label based indexing
Boolean based indexing
Both of the above
None of the above
The following statement will return the column as a _______ DF.loc[: , 'Name'] #DF is a DataFrame object
DataFrame
Series
List
Tuple
We can use the ______ method to merge two DataFrames
merge( )
join( )
append( )
drop( )
The following two statement will return _______________ DF.loc[:,'Name'] #DF is a DataFrame object DF['Name'] #DF is a DataFrame object
Same Output
Name column of DataFrame DF
Both of the above
Different Output
The following statement will display ________ rows of DataFrame ‘DF’ print(df.loc[[True, False,True]])
1
2
3
4
What we are doing in the following statement? dF1=dF1.append(dF2) #dF1 and dF2 are DataFrame object
We are appending dF1 in dF2
We are appending dF2 in dF1
We are creating Series from DataFrame
None of the above
______________ parameter is used in append( ) function of DataFrame to get the column labels in sorted order.
sorted
sorter
sort
None of the above
________ parameter of append( ) method may be set to True when we want to raise an error if the row labels are duplicate.
verify_integrity
verifyintegrity
verify.integrity
None of the above
The ________________parameter of append() method in DataFrame may be set to True, when we do not want to use row index labels.
ignore_index_val
ignore_index_value
ignore_index
None of the above
Which of the following attribute of DataFrame is used to display data type of each column in DataFrame?
Dtypes
DTypes
dtypes
datatypes
The append() method of DataFrame can also be used to append ____________to a DataFrame
Series
Dictionary
Both of the above
None of the above
Which of the following attribute of DataFrame is used to display row labels?
columns
index
dtypes
values
Which of the following attribute of DataFrame is used to display column labels?
columns
index
dtypes
values
Which of the following attribute of DataFrame display all the values from DataFrame?
values
Values
val
Val
Which of the following attribute of DataFrame display the dimension of DataFrame
shape
size
dimension
values
If the following statement return (5, 3) it means _____ >>>DF.shape #DF is a DataFrame object
DataFrame DF has 3 rows 5 columns
DataFrame DF has 5 rows 3 columns
DataFrame DF has 3 rows 5 rowlabels
None of the above
Transpose the DataFrame means _____________
Row indices and column labels of the DataFrame replace each other’s position
Doubling the number of rows in DataFrame
Both of the above
None of the above
Following statement will display ___________ rows from DataFrame ‘DF1’. >>>DF1.head()
All
2
3
5
Which of the following is used to display first 2 rows of DataFrame ‘DF’?
DF.head( )
DF.header(2)
DF.head(2)
None of the above
Which of the following statement is Transposing the DataFrame ‘DF1’?
DF1.transpose
DF1.T
DF1.Trans
DF1.t
Which of the following function display the last ‘n’ rows from the DataFrame?
head( )
tail( )
Tail( )
None of the above
We can merge/join only those DataFrames which have same number of columns.(T/F)
True
False
Which property of dataframe is used to check that dataframe is empty or not?
isempty
IsEmpty
empty
Empty
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
(3, 4)
(4, 3)
(3, 3)
None of the above
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
9
12
6
None of the above
Parameters of read_csv( ) function is _____
sep
header
Both of the above
None of the above
Which of the following function is used to load the data from the CSV file into a DataFrame?
read.csv( )
readcsv( )
read_csv( )
Read_csv( )
The default value for sep parameter is _________
comma
semicolon
space
None of the above
Write statement to display the row labels of ‘DF’.
DF.Index
DF.index( )
DF.index
DF.row_index
Write statement to display the column labels of DataFrame ‘DF’
DF.Column
DF.column
DF.columns
DF.Columns
Display first row of dataframe ‘DF’
print(DF.head(1))
print(DF[0 : 1])
print(DF.iloc[0 : 1])
All of the above
Display last two rows from dataframe ‘DF’
print(DF[-2 : -1])
print(DF.iloc[-2 : -1])
print(DF.tail(2))
All of the above
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
True
False
Yes
None of the above
Write statement to display the data types of each column of dataframe ‘DF’.
DF.types( )
DF.dtypes
DF.dtypes( )
None of the above
