Python Tutorial 6
Numpy and Pandas
Quiz
[Link] of the returns the statistical data about the numerical
columns in the data frame df?
1. print([Link]())
2. print([Link]())
3. print(describe(df))
4. print(stats(df))
[Link] of the following is/are used to get the columns named
‘clmn1’ and ‘clmn3’ from the data frame df?
1. print([Link]['cl3','cl5'])
2. print([Link][['cl3','cl5']])
3. print([Link][['cl3','cl5']])
4. print([Link]['cl3','cl5'])
[Link] does the below code do?
[Link].value_counts()
1. Return the number of values in the column
2. Return the frequency of occurrences of each unique value
3. Return the number of rows
4. None of the above
[Link] is the output of the below code?
[Link][[Link]==10,:]
1. Return the columns clmn where the value is equal to 10
2. Return all the columns of the data frame df withe value equals 10
3. Return all the columns clmn and the first 10 rows
4. None of the above
[Link] is the output of the following code?
print([Link][2:5])
1. prints the 2nd, 3rd,4th,5th columns of the dataframe df
2. prints the 2nd, 3rd,4th columns of the dataframe df
3. prints the 2nd, 3rd,4th rows of the dataframe df
4. prints the 2nd, 3rd,4th,5th rows of the dataframe df
[Link] of the following is the correct way to create a data frame?
1. [Link]( data, index, columns, dtype, copy)
2. [Link]( data, index, columns, dtype, copy)
3. [Link]( data, index, columns, dtype,)
4. [Link]( data, index, columns, dtype)
[Link] of the following can be stored in a dataframe?
1. a two-dimensional ndarray
2. lists, dictionaries, or Series.
3. Pandas DataFrame
4. All the above
[Link] of the following commands return the data type of the
values in each column in the data frame df?
1. print([Link])
2. print(dtypes(df))
3. print([Link])
4. None of the above
[Link] a dataset named ‘data’ containing the 5 columns and 10
rows, find the output of the below code?
print(len([Link]))
1. 5
2. 10
3. 15
4. 50
[Link] which of the following files, pandas can read data?
1. JSON
2. Excel
3. HTML
4. All the above
[Link] of the following features is not provided by the Pandas
module?
1. Merge and join the data sets
2. Filter data using the condition
3. Plot and visualize the data
4. None of the above
12. What is the correct syntax to create a Pandas Series from a Python
list?
1. [Link](mylist)
2. [Link](mylist)
3. [Link](mylist)
[Link] is the correct syntax to return the first value of a Pandas
Series?
1. myseries[0]
2. [Link](0)
3. get(myseries,0)
[Link] is the correct syntax to add the labels "x", "y", and "z" to a
Pandas Series?
1. [Link](mylist, labels = ["x", "y", "z"]
2. [Link](mylist, index = ["x", "y", "z"]
3. [Link](mylist, names = ["x", "y", "z"]
[Link] is the correct syntax to create a Pandas DataFrame?
1. [Link](data)
2. [Link](data)
3. [Link](data)
[Link] is the correct syntax to return the first row in a Pandas
DataFrame?
1. [Link][0]
2. df[0]
3. [Link][0]
[Link] is the correct syntax to return both the first row and the
second row in a Pandas DataFrame?
1. df.[[0-1]]
2. df.[[0, 1]]
3. [Link][[0, 1]]
4. [Link][[0-1]]
[Link] is the correct Pandas function for loading CSV files into a
DataFrame?
1. ReadFile()
2. read_csv()
3. read_file()
4. ReadCSV()
[Link] is the correct Pandas function for loading JSON files into a
DataFrame?
1. ReadJSON()
2. ReadFile()
3. read_file()
4. read_json()
[Link] is the correct syntax to load a Python Dictionary called "data"
into a Pandas DataFrame?
1. [Link](data)
2. pd.load_json(data)
3. [Link](data)