WorksheetsDataFrame in Pandas
Total questions: 20
Worksheet time: 10mins
df['Tid'] & df.Tid are same
true
false
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
Which of the following commands is used to convert array named "grades" into data frame named "df_grades"?
df_grades = grades
df_grades = pd.DataFrame(grades)
df_grades = pd.DataFrame("grades")
grades = pd.DataFrame(df_grades)
Type the syntax that returns the top 5 rows in DataFrame df with the native Pandas function (not slicing):
(a)
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
iloc()
Which of the following statement/s will give 3 rows from bottom of the dataframe ?
Print(df.tail())
print(df.tail(3))
print(df.tail[3])
i) Which of the following statement will delete rank2 row from the dataframe ?
df.drop(‘rank2’)
df.drop(rank2)
delete df(rank2)
df.del(“rank2”)
The instructor wants to add a new column, Marks to the dataframe. The values of the marks will be 12, 22, 21, 24. Help him to choose the correct command to do so.
a) Df.columns=[12, 22, 21, 24]
b) df[‘marks’] = [12, 22, 21, 24]
c) df.loc[marks] = [12, 22, 21, 24]
d) Both (b) and (c) are correct
The axis=1 identifies a DataFrame's ____________
Rows
Values
Columns
Data Types
___________ attribute is used to specify column labels
column ()
column
columns()
columns
To get number of elements in a DataFrame _____ attribute may be used.
size
shape
values
ndim
To extract a row / column from a DataFrame ___ function may be used
row()
column()
loc()
All of the above
The insert function requires ____ number of arguments in DataFrame.
1
2
3
4
For the given DataFrame df, what will be the code to get the value 38?
df . iloc [1,1]
df . Age [222]
df . loc [111]
None of the above
