wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Play with Python Lib

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is a correct syntax to create a Pandas Series from a Python list?

a)

pd.Series(mylist)

b)

pd.createSeries(mylist)

c)

pd.getSeries(mylist)

2.

What is a correct syntax to return the first value of a Pandas Series?

a)

myseries.get(0)

b)

myseries[0]

c)

get(myseries, 0)

3.

What is a correct syntax to add the lables "x", "y", and "z" to a Pandas Series?

a)

pd.Series(mylist, index = ["x", "y", "z"])

b)

pd.Series(mylist, lables = ["x", "y", "z"])

c)

pd.Series(mylist, names = ["x", "y", "z"])

4.

What is a correct syntax to create a Pandas DataFrame?

a)

pd.DataFrame(data)

b)

pd.df(data)

c)

pd.dataframe(data)

5.

What is a correct syntax to return the first row in a Pandas DataFrame?

a)

df[0]

b)

df.loc[0]

c)

df.get(0)

6.

What is a correct syntax to return both the first row and the second row in a Pandas DataFrame?

a)

df.loc[[0, 1]]

b)

df.[[0, 1]]

c)

df.[[0-1]]

d)

df.loc[[0-1]]

7.

What is the correct Pandas function for loading CSV files into a DataFrame?

a)

read_csv()

b)

read_file()

c)

ReadCSV()

d)

ReadFile()

8.

When you print a DataFrame, by default you will get the headers and how many rows?

a)

the first 10 and the last 10

b)

the first 10

c)

the first 5

d)

the first 5 and the last 5

9.

What is a correct syntax to return the entire DataFrame

a)

df.to_string()

b)

df.Full()

c)

df.print_full()

d)

df.dump()

10.

What is the correct Pandas function for loading JSON files into a DataFrame?

a)

read_file()

b)

read_json()

c)

ReadFile()

d)

ReadJSON()

11.

What is a correct syntax to load a Python Dictionary called "data" into a Pandas DataFrame?

a)

pd.DataFrame(data)

b)

pd.load_json(data)

c)

pd.ReadJSON(data)

12.

What does the Pandas head() method do?

a)

Returns the headers

b)

Returns the headers and the specified number of rows, starting from the top

c)

Returns the specified number of rows, starting from the top

13.

For the Pandas head() method, how many rows are returned by default, if you do not specify it?

a)

All

b)

10

c)

5

14.

What is a correct Pandas method for returning the last rows?

a)

last()

b)

tail()

c)

back()

d)

foot()

15.

What is a correct Pandas method for removing rows that contains empty cells?

a)

delete_null

b)

dropna()

c)

remove_null()

16.

True or false: by default, the Pandas dropna() method returns a new DataFrame, and will not change the original.

a)

True

b)

False

17.

What is a correct method to fill empty cells with a new value?

a)

value_null()

b)

fillna()

c)

insertna()

d)

replacena()

18.

When using the Pandas dropna() method, what argument allowes you to change the original DataFrame instead of returning a new one?

a)

dropna(inplace = True)

b)

dropna(original = True)

c)

dropna(keep = True)

19.

Mean, Median, Mode. Which one returns the value in the middle?

a)

median()

b)

mode()

c)

mean()

20.

Mean, Median, Mode. Which one returns the value that appears most frequently?

a)

mode()

b)

median()

c)

mean()

21.

Mean, Median, Mode. Which one returns the average value?

a)

mode()

b)

mean()

c)

median()

22.

What is a correct method to remove duplicates from a Pandas DataFrame?

a)

df.drop_duplicates()

b)

df.remove_duplicates()

c)

df.duplicates()

d)

df.delete_duplicates()

23.

What is a correct method to discover if a row is a duplicate?

a)

df.duplicate()

b)

df.dup()

c)

df.duplicated()

24.

What is a correct method to find relationships between column in a DataFrame?

a)

df.corr()

b)

df.correlation()

c)

df.rel()

d)

df.relation()

25.

What is a correct method to plot (draw) diagrams from the data in a DataFrame?

a)

df.draw()

b)

df.print()

c)

df.plot()