Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

XII TERM I Dataframes

Total questions: 33

Worksheet time: 3hrs 45mins

Name
Class
Date
1.

Which among the following options can be used to create a DataFrame in Pandas?

a)

A scalar value

b)

An ndarray

c)

A python dict

d)

All of the above

2.

Which function views dataframe in the form of vertical subset ie column wise?

a)

iterrows()

b)

iteritems()

3.

Which of the functions can be used to delete column/row from a DataFrame?

a)

pop()

b)

at()

c)

drop()

d)

iloc()

4.

Which of the following statement/s will give 2 rows from bottom of the dataframe ?

a)

Print(df.tail())

b)

print(df.tail(2))

c)

print(df.tail[2])

d)

print(df.tail(4))

5.

i) Which of the following statement will delete rank2 row from the dataframe ?

a)

df.drop(‘rank2’)

b)

df.drop(rank2)

c)

delete df(rank2)

d)

df.del(“rank2”)

6.

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)

a) Df.columns=[12, 22, 21, 24]

b)

b) df[‘marks’] = [12, 22, 21, 24]

c)

c) df.loc[marks] = [12, 22, 21, 24]

d)

d) Both (b) and (c) are correct

7.
A Dataframe contains Heterogeneous data
a)
true
b)
false
8.
df[‘List3’]=df[‘List1’]+df[‘List2’]
a)
Syntax is correct
b)
sytax not correct
c)
Can not use arithmatic operators
9.
In Pandas loc() and iloc() methods are same
a)
true
b)
false
10.
Is boolean Indexing possible in Data Frame
a)
true
b)
false
11.

The __________ attribute of a dataframe object returns the row labels of a dataframe.

a)

columns

b)

Columns

c)

Index.Values

d)

index.values

12.

Say true or false, A Dataframe object is mutable.

a)

True

b)

False

13.

DataFramedf

Age Name

rank1 28 Tom

rank2 34 Jack

rank3 29 Steve

rank4 42 Ricky

Find out the command used to get the following output from the above dataframe,

Age

rank1 28

rank2 34

rank3 29

rank4 42

a)

Print(df[‘Age’])

b)

print(df[‘Age’])

c)

print(df(‘Age’))

d)

Print(df[‘Age’], axis=1)

14.

The instructor wants to know the age of the persons with rank3. Help her to identify the correct set of statement/s from the given options:

a)

a) Print(df.loc[‘rank3’])

b)

b) print(df.iloc[‘rank3’])

c)

c) print(df.loc[‘rank3’])

d)

d) Print(df.loc(‘rank3’))

15.

The acronym csv is short for

a)

Comma Special Values

b)

Comma Separated Values

c)

Case Separated Values

d)

Comma Separate Values

16.

A common format for data interchange

a)

xlsx

b)

csv

c)

docx

d)

table

17.

Method used to bring data from a csv file into a DataFrame

a)

readcsv()

b)

read_table()

c)

read_csv()

d)

read-csv()

18.

Argument used to provide own column headings instead of column headings in csv file

a)

names

b)

header

c)

skiprows

d)

index_col

19.

Select the correct way to give the path of the file in read_csv()

a)

C:/data/myfile.csv

b)

C:\\data\\myfile.csv

c)

C:\data\myfile.csv

d)

C:data/myfile.csv

20.

If the argument header=None is given, what will be the headings

a)

1,2,3 etc

b)

A,B,C etc

c)

0,1,2 etc

d)

I,II,iii

21.

Argument used to skip rows while fetching data from csv file

a)

skiprow

b)

skip_row

c)

SkipRows

d)

skiprows

22.

Default separator of csv

a)

Tab

b)

Space

c)

Comma

d)

Pipe

23.

pd.read_csv(‘data.csv’,skiprows=[1,2,3,6]

What this statement trying to do

a)

Code reads csv file namely data.csv and it will read records 1,2,3,6

b)

Code reads csv file namely data.csv and it will skip 1,2,3,6

c)

Code reads csv file namely data.csv and it will provide headings as 1,2,3,6

24.

Command to be given before doing anything with Pandas

(a)  

25.
A Dataframe has axes column index (axis=0) row index (axes=1)
a)
true
b)
false
26.
A data frame can be created using:
a)
Lists
b)
Dictionary
c)
Series
d)
A numpy 2D array
27.

df['Tid'] & df.Tid are same

a)

true

b)

false

28.

Which of the following commands is used to convert array named "grades" into data frame named "df_grades"?

a)

df_grades = grades

b)

df_grades = pd.DataFrame(grades)

c)

df_grades = pd.DataFrame("grades")

d)

grades = pd.DataFrame(df_grades)

29.

Which of the functions can be used to delete column/row from a DataFrame?

a)

pop()

b)

at()

c)

iloc()

30.

The axis=1 identifies a DataFrame's ____________

a)

Rows

b)

Values

c)

Columns

d)

Data Types

31.

To get number of elements in a DataFrame _____ attribute may be used.

a)

size

b)

shape

c)

values

d)

ndim

32.

To extract a row / column from a DataFrame ___ function may be used

a)

row()

b)

column()

c)

loc()

d)

All of the above

33.

For the given DataFrame df, what will be the code to get the value 38?

a)

df . iloc [1,1]

b)

df . Age [222]

c)

df . loc [111]

d)

None of the above