Lesson 10-19 Final Review Flashcards

1
Q

True or False, A try block can be used to detect and handle a file not found error, when trying to open a file for reading.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False, The open() function can be used in order to read as well as write to files.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False, The open() function will read the contents of a file into a variable.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True or False, The readline() method will return an empty string when there is no more data to read from a file.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False, The string split() method only recognizes the comma as a delimiter

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False, The string split() method returns a string result.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False, The result of the open function can be used as part of a for statement to loop over and read each line of a file.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False, The statements in an except block will get executed.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following methods can be used to read a line of a file into a string variable?

A.getline()
B.readline()
C.open()
D.all of the above

A

B.readline()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True or False. In order to read a file in Python, the open() function can be used to connect a variable with the file.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A function that can be used to write data to a file is:
A.write()
B.print()
C.save()

A

B. print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

After all lines of a file have been read, what will a subsequent call to readline() return?
A.
B.”(empty string)
C.0
D.an error

A

B. “(empty string)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Before writing to a text file, what function should be called, to associate a variable with the file?
A.input()
B.print()
C.open()
D.write()

A

C.open()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The primary Python keywords for detecting and handling an exception are:
A.try,except
B.if,else
C.for,while
D.input,print

A

A. try, except

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The string returned by the readline() method includes which character at the end of the returned string?
A.\n
B.\t
C.
D.'

A

A.\n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which function can be used to write items to a text file?
A.print()
B.input()
C.write.Line()
D.save()

A

A.print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

After all lines have been written to a file, what method should be called, to ensure all lines have been saved?
A.open()
B.close()
C.save()
D.end()

A

B. close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which statement can be used to associate a text file with a Python variable for subsequent reading?
A.f = open()
B.f = open(‘r’,’input.txt’)
C.f = open(‘input.txt’,’r’)
D.’input.txt’.open()

A

C.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The print() named parameter for specifying what to place between each item is:
A.delim
B.sep
C.csv
D.fieldsep

A

B.sep.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The string split() method returns what type?
A.a string
B.an int
C.a float
D.a list

A

D.a list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

An example where Python will generate an exception is:
A. The last item returned from range()
B.A call to open() to read a file that does not exist
C.An infinite loop
D.The use of break in a repetition body

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The pandas function that can read a comma separated file’s data into a DataFrame is:
A.load_data()

B.read_csv()

C.read_data()

A

B. read_csv()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

True or False: When reading data from a file into a DataFrame, the data must be separated by commas.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

True or False: The head() and tail() methods can only show one row of a DataFrame’s data.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Which can be used to determine the number of columns in a DataFrame? (select the best, most complete, answer)

A. the len() function
B.the shape property
C.the info() method
D. the shape property and info method
E. the shape property and len() function
F.the shape property, info() method, and the len() function

A

F.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

The pandas type for storing tabular data is called a:
A.DataFrame
B.table
C.ptable
D.Worksheet

A

A. DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

True or False: Python has a built-in table data structure

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

True or False: Values in pandas Series cells are limited to int, float, and str types.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What type of result is returned by the DataFrame head() method?

A.DataFrame
B.Series
C.List
D.Dictionary

A

A.DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What does the DataFrame shape property indicate?
A.The number of rows and columns of the DataFrame
B.If the DataFrame is rectangular or another shape
C.The number of empty cells in the DataFrame
D.none of these

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

One approach to determine the number of missing values in a DataFrame is to:
A. the info() method
B.use the missing method
C.use for repetition and count the number of None values
D.find the total of each column

A

A. the info() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

True or False: Each DataFrame column optionally has a name

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

True or False: For efficiency, pandas uses the Python float type to represent numbers.

A

Flase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What pandas function can be used to read a tabular text file and return a DataFrame?
A.read_csv()

B.read_data()

C.read_text()

D.load_data()

A

A.read_csv()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

True or False,Pandas main focus is on non-tabular data.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

True or False: The pandas read_csv() function requires files to in CSV (comma-separated value) format.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

In order to sort a DataFrame without creating a new DataFrame, the parameter specified is:
A.inplace
B.ascending
C.newframe
D.copydf

A

A.inplace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

The tolist() method returns:
A. a list from a series
B.a series from a list
C.a series from a DataFrame
D.None of these options

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

If df is a DataFrame, and ‘colname’ is one of its column names, the expression df[‘colname’] returns:
A.a DataFrame
B.a Series
C.a Python List
D.None of these options

A

B. a Series

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

If df is a DataFrame, and ‘colname1’ and ‘colname2’ are two of its column names, the expression df[[‘colname1’, ‘colname2’]] returns:

A.a DataFrame
B.a Series
C.a Python List
D.None of these options

A

A. a DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

The method to sort a DataFrame is:
A.sort()
B.sorted()
C.sort_values()
D.order()

A

C.sort_values()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

If df is a DataFrame, and colname is one of its columns, which is a valid filter expression? (Select the best, most complete, answer)

A. df[df.colname==100]
B. df[df[‘colname’]==100]
C.df[colname==100]
D. None of the options
E. All the options
F. Both A&B

A

F. A&B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

If df is a DataFrame, and ‘rowname’ is a name of one of its rows, which expression returns a row of the DataFrame?

A. df.iloc[‘rowname’]
B. df.loc[‘rowname’]
C. df.rowname
D. None of the options
E. All of the options

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

How can values in a pandas Series method be accessed as a Python list?
A.using the tolist() method
B.using the getlist() method
C.using the list constructor
D.any of these

A

A. using the tolist() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

For a DataFrame df, how can its first row be accessed?
A. df.iloc[0]
B. df[0]
C.df.loc[0]
D. any of these

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

If df is a pandas DataFrame with a column named ‘Sales’, what type of result is returned by df[‘Sales’] ?
A.pandas Series
B.a list
C.a dictionary
D.a pandas DataFrame

A

A. Pandas Series

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

For several methods, pandas provides the ____named parameter, to indicate whether a new DataFrame is returned, or an existing DataFrame is updated.

A

inplace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

If df is a pandas DataFrame with a column named ‘Sales’, what expression is an example of a filter expression?

A. df[df.Sales > 100]
B. df.filter(‘Sales > 100’)
C. [df.Sales > 100]
D. filter(Sales > 100)

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

How can one row of a DataFrame be accessed?
A. using the .loc[] accessor
B. using the column name
C. using curly braces
D. none of these

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

Which DataFrame method can be used with for, to iterate over the rows of a DataFrame?
A.iterrows()
B.row()
C.for()
D.index()

A

A. iterrows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is the purpose of descriptive analytics in an analytics project?
A.To predict future outcomes
B.To prescribe actions based on data analysis
C.To summarize and understand what has happened or is happening
D.To transform and standardize data

A

C.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

What is a reason for standardizing data?
A.To predict future outcomes accurately
B.Enable meaningful comparisons regardless of scale of the original data
C.To summarize data and understand trends
D.To identify outliers in the dataset

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

What does the shape attribute of a DataFrame tell you?
A.The size of the DataFrame memory
B.The number of rows and columns in the DataFrame
C.The data types of the columns in the DataFrame
D.The unique values in the DataFrame

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

What is the general syntax to use the describe() function on a column?
A.dataframe.describe(column_name)
B.column_name.describe()
C.describe(dataframe, column_name)
D.dataframe[‘column_name’].describe()

A

D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

What is the purpose of the describe() function?

A.Calculate the mean, median, and mode of a column
B.Generate graphical analysis such as bar charts and histograms
C.Provide summary statistics of a DataFrame
D.Apply advanced transformations to data

A

C.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

What does the describe() method provide for a numerical column?

A.mean, median
B.minimum and maximum values
C.standard deviation and quartiles
D.All of the options
E.None of the options

A

D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

What does the unique() function in pandas do?

A.Returns the count of unique values in a column
B.Returns the unique values in a column
C.Returns the most frequent value in a column
D.Returns the average of unique values in a column

A

B. Returns the unqiue values in a column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

What type of analytics tells us what is likely to happen next?

A.Descriptive Analytics
B.Predictive Analytics
C.Prescriptive Analytics
D.Explanatory Analytics

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

How can you read an Excel file into a pandas DataFrame?
A.pd.read_excel(‘filename.xlsx’)
B.pd.read_csv(‘filename.csv’)
C.pd.read_file(‘filename’)

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

How can you insert a new column into a specific position in a DataFrame?

A.add_column()

B.insert()

C.new_column()

D.append_column()

A

B.insert()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

What is the purpose of the tail() function in pandas?

A.Group data based on specified fields
B.Display the first few rows of the DataFrame
C.Calculate summary statistics
D.Display the last few rows of the DataFrame

A

D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

What does the shape function return for a DataFrame?
A.Total number of rows and columns
B.Number of unique values in each column
C.Summary statistics for each column
D.The first few rows of the DataFrame

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

Using the sort_values() method, how can you sort the results of a groupby operation in descending order?

A.By setting the ascending parameter to True

B.By using the sort_values() function

C.By using the get_group() function

D.By setting the ascending parameter to False

A

D

64
Q

How can you set the index of a DataFrame to a specific column?
A.Using the groupby() function
B.Using the sort_values() function
C.Using the shape() function
D.Using the set_index() function

A

D.

65
Q

What is the purpose of the agg() function in pandas?
A.Sort data in ascending order
B.Group data based on specified fields
C.Calculate summary statistics
D.Filter data based on conditions

A

C.

66
Q

What is the purpose of the groupby() function in pandas?

A.Sort data in ascending order
B.Group rows of data based on specified fields
C.Calculate summary statistics
D.Filter data based on conditions

A

B.

67
Q

What does the dropna parameter do in the groupby() method?
A.Controls whether to show observed values for categorical groupers
B.Controls whether to drop NA values together with row/column
C.Controls whether to sort group keys
D.Controls whether to return object with group labels as the index

A

B.

68
Q

What is the default sorting order of sort_values() in pandas?

A.Descending Order
B.Randome Order
C.Ascending Order
D.No specfic order

A

C.

69
Q

True or False: The groupby() function returns a new DataFrame containing the grouped data.

A

False

70
Q

To sort a DataFrame based on one or more columns, we can use the sort_values() function with the parameter by=’column_name’ and specify the column(s) we want to ____ by.

A

sort

71
Q

What parameter of the groupby() method is used to determine the groups for grouping a DataFrame in Python?
A.axis
B.asindex
C.by
D.level

A

C. by

72
Q

By default, which of the following statements is true about sort_values() in pandas?

A.It modifies the original DataFrame
B.It can only sort by a single column.
C.It returns a new DataFrame with the sorted data.
D.It requires the columns to be of string data type.

A

C

73
Q

In the sort_values() function, which sorting algorithm is the default choice for the kind parameter?
A.quicksort
B.mergesort
C.heapsort
D.stable

A

A. quicksort

74
Q

In the groupby() method, if the sort parameter is set to False, what does it affect?
A.The order of observations within each group
B.The order of rows within each group
C.The order of columns within each group
D.The order of group keys

A

D.

75
Q

What is the purpose of the sort_values() method in pandas?
A.To sort a DataFrame based on the values along a specified axis.
B.To sort a DataFrame based on the index labels.
C.To sort a DataFrame based on column levels.
D. To sort a DataFrame based on multiple sort orders.

A

A.

76
Q

The groupby() function in Pandas is used to ___ a DataFrame based on one or more columns

A

group

77
Q

What is the purpose of the as_index parameter in the groupby() function?
A.It specifies the column(s) to group by
B.It determines whether the groups should be treated as separate dataframes.
C. It determines the sorting order of the groups
D.It sets the index of the resulting grouped DataFrame

A

D

78
Q

Which parameter in the sort_values() function specifies the name or list of names to sort by?

A.axis
B.by
C.ascending
D.inplace

A

B. by

79
Q

What is the default value for the ascending parameter?
A.False
B.True
C.None
D.’quicksort’

A

B.True

80
Q

True or False:The groupby() function can be applied to multiple columns by passing a list of column names to the by parameter, like df.groupby(by = [‘column1’, ‘column2’]).

A

True

81
Q

To sort a DataFrame in descending order, we can set the parameter ascending of the sort_values() function to ___.

A

False

82
Q

What does the dtypes() method return for a pandas DataFrame?

A.The number of rows in the DataFrame

B.The number of columns in the DataFrame

C.The data types of the columns in the DataFrame

D.The index labels of the DataFrame

A

C.

83
Q

Which method is used to check whether a value in a pandas DataFrame is null or missing?

A.isnull()
B.dtypes()
C.fillna()
D.replace()

A

A.isnull()

84
Q

What does the replace() method do in pandas?
A.Replaces all values in a DataFrame with a specified value
B.Replaces specific values in a DataFrame with other specified values
C.Replaces missing values with a specified value in a DataFrame
D.Replaces the data types of columns in a DataFrame

A

B.

85
Q

For numeric columns, pandas uses what value to represent missing data?

a) Python None
b) empty string
c) NumPy NaN
(a) and (c)
(a) and (b)
All of the options
None of the options

A

C. NumPy Nan

86
Q

What method can be used to locate DataFrame cells with missing data? (Select the best, most complete, answer)

a) ismissing()
b) isna()
c) novalue()
(a) and (b)
(a) and (c)
All of the options
None of the options

A

B. isna()

87
Q

What does the isnull() function in Python return?
A. True if the value is null, False otherwise
B.True if the value is non-null, False otherwise.
C. True if the value is missing, False otherwise.
D. None of these options

A

A.

88
Q

Which method is designed to replace missing values in a pandas DataFrame with a specified value? (Select the most efficient method)

A. isnull()
B. dtypes()
C. filna()
D. replace()

A

C.

89
Q

Which method can be used for replacement when the to_replace parameter is a scalar, list, or tuple, and the value parameter is None?

A. ‘pad’
B. ‘ffill’
C. ‘bfill’
D. All of the above
E. None of the above

A

D.

90
Q

If the limit parameter is set to a value greater than 0 in the fillna() function, what does it indicate?

A. The maximum number of entries along the entire axis where NaNs will be filled
B. The maximum number of consecutive NaN values to forward/backward fill
C. The maximum number of columns to fill with NaN values
D. The maximum number of rows to fill with NaN values

A

B.

91
Q

What is the default value of the inplace parameter in the replace() function?
A.True
B.False
C.None
D.It depends on context

A

B. False

92
Q

Which method involves imputing missing values with the overall mean of the feature?

A.Regression replacement
B.Median replacement
C.Use prior knowledge to estimate the value
D.Mean replacement

A

D.

93
Q

Which method involves replacing missing values with an educated guess based on the analyst’s expertise in the area?

A. Use prior knowledge to estimate the value
B. Median replacement
C.Mean replacement
D.Regression replacement

A

A.

94
Q

What should be done regardless of the method used for missing data?
(a) Create a new feature indicating if missing data was imputed
(b) Repeat the analysis with and without missing data
(c) Use regression replacement for imputing missing values
(d) Remove all records with missing data
(e)All of the options
(f) (a) and (b)
(g) (a) and (c)
(h) (a) and (d)

A

F.

95
Q

What does the fillna() function in pandas return when the inplace parameter is set to True?

A.The original DataFrame with missing values filled
B.A new DataFrame with missing values filled
C.None
D.An error will be raised if inplace is set to Tru

A

C.

96
Q

Which parameter in the fillna() function specifies the method to use for filling missing values?

A.values
B.method
C.inplace
D.limit

A

B. Method

97
Q

Which parameter of the replace() function in Python’s pandas library is used to specify the values that will be replaced?

A.to_replace
B.value
C.inplace
D.limit

A

A.

98
Q

Which method can be used to process each value of a given column?

a) each()
b) apply()
c) lambda()

A

B. apply()

99
Q

A category column can be created using which method?
A. category()
B.astype()
C. unique()

A

B.astype()

100
Q

Which can be used to review the datatype of a DataFrame Column
A. the dtype Property
B.the info() method
C. the python type() function
D. Both A&B

A

D. Both A&B

101
Q

The method to display the set of values occurring in a data frame column is:

A. occuring()
B. unique()
C. tolist()

A

B. unique()

102
Q

What method can be used to see which rows have duplicate values within a certain column?

A.the is_unqiue property
B.the duplicated() method
C.the isna() method

A

B.

103
Q

Which can be used to see if a column has unique values?
A.the is_unqiue property
B.the duplicated() method
C.the info() mehtod

A

A. the is_unqiue property

104
Q

Assume a Python list has valid values for a given data frame column. To create a new data frame column indicating which rows have valid values, we can use:

A. the split method()
B. a lambda method with an in expression
C. list slicing

A

B.

105
Q

New string columns can be created from a single data frame column using which method?

A.multicol()
B.split()
C.astype()

A

B. split()

106
Q

True or False: A lambda function can be used in combination with the pandas apply() method.

A

True

107
Q

The pandas DataFrame method that can be used to filter out duplicate values is:

A. drop_duplicates()

B. filter_repeats()

C. drop_matched()

D. filter_matched()

A

A.

108
Q

Which is not a rule for read_csv() as related to numbers:
A. If a column has integer values and some missing values, pandas will use the Python int type or None for the values in the column

B.If any value of a column is non-numeric, the column’s values are represented as Python types as opposed to NumPy types

C. If all values in a column are numeric and any value has decimal places, the column is represented as a NumPy float

A

A.

109
Q

For a pandas DataFrame df, which expression can be used to find rows with missing values for the column named id?

A. df[df.id.isna()]
B. df.id.isna
C. df.id.False
D. df.missing(‘id’)

A

A.

110
Q

Which pandas method can generate category labels based on numeric ranges?

A.cut()
B.range()
C.category()
D.snip()

A

A. cut()

111
Q

Which pandas Series method generate the set of unique values in a Series?
A.unique()
B.distinct()
C.keys()
D.values()

A

A.uniue()

112
Q

Which pandas method can create numeric values?
A.to_numeric
B.number()
C.gennum()
D.asfloat()

A

A.to_numeric

113
Q

Which pandas method can be used to filter out rows with missing values?

a) dropna()
b) filter()
c) isnull()
d) exclude()

A

A.dropna()

114
Q

Which pandas method can create Timestamp values?
A.to_datetime()
B.time()
C.gentime()
D.astime()

A

A.to_datetime()

115
Q

Which is a valid pandas expression, to create a new column in percent from another column in decimal?

A. df[‘tax_pct’] = df[‘tax_dec’] * 100
B. df[‘tax_pct’] *= 100

C. df[‘tax_pct’] = df.scale(‘tax_dec’, 100)
D. df[‘tax_pct’] = df.tax_dec % 100

A

A.

116
Q

True or False: For data preparation, replacing original data as opposed to creating new data is generally preferred.

A

False

117
Q

What type of argument is provided to the pandas apply() method?

A. function
B.string
C.list
D.dictionary

A

A. function

118
Q

Which pandas Series method can be used to generate several string columns from a single column

A.str.split()
B.generate()
C.expand()
D.tokenize()

A

A.str.split()

119
Q

Inter-field validity checks can be implemented with

A. Both of these
B. DataFrame filter expression
C. the DataFrame apply()

A

A. Both of these

120
Q

The Series method to return which rows have duplicated values is:

A.duplicated()
B.repeated()
C.nonunique()
D.not_unqiue()

A

A. Duplicated()

121
Q

What pandas Series property indicate the type used for the data?
A.dtype
B.type
C.info
D.none of these

A

A. dtype

122
Q

Which pandas method can be used to create a column with a particular NumPy datatype size?

A.astype()
B.type()
C.memsize()
D.minimize()

A

A.astype()

123
Q

Which pandas DataFrame method can be used to generate a new DataFrame with a different organization of the data?

A. All of these
B. Melt()
C.transpose()
D. pivot()

A

A. All of these

124
Q

Which Series property indicates if its values are distinct?

a) is_unqiue

b) distinct

c) unique

d) is_distinct

A

A. is_unqiue

125
Q

What is the purpose of the axis parameter in the concat() method?
A.It specifies the columns to be concatenated.
B.It specifies the rows to be concatenated.
C.It specifies the axis to concatenate along.
D.It renames the index labels of the concatenated DataFrame.

A

C.

126
Q

Which parameter of the merge() method specifies the type of merge to be performed?

a) right
b) how
c) on
d) validate

A

B. how

127
Q

Which of the following statements about the concat() method in pandas is correct? (select all that apply)
A.concat() is used to combine two or more DataFrames vertically
B.concat() is used to combine two or more DataFrames horizontally
C.concat() is used to sort a DataFrame in ascending order
D.concat() is used to rename columns in a DataFrame.

A

A&B

128
Q

Which parameter of the DataFrame.join() method specifies the columns to join on?

A.other
B.on
C.how
D.validate

A

B.on

129
Q

What does the indicator parameter of the merge() method do?
A. Adds a column to the output DataFrame indicating the source of each row
B.Sorts the join keys lexicographically in the result DataFrame
C. Specifies the column names to be added as suffixes to overlapping columns
D. Determines whether a copy of the merged objects is created

A

A.

130
Q

What is the default value for the ‘how’ parameter in the DataFrame.join() method?

A.left
B.right
C.outer
D.inner

A

A.left

131
Q

Which of the following statements is true about the pandas.DataFrame.join method? (select all that apply)
A.The join method performs a merge operation based on the index labels of the two DataFrames.
B.The join method performs an inner join by default.
C.The join method supports joining on multiple columns.
D. The join method modifies the original DataFrame in-place

A

A&C

132
Q

Which parameter determines the axis to concatenate along in the pandas.concat function?

A. join
B.axis
C.ignore_index
D.keys

A

B. axis

133
Q

When concatenating all Series along the index (axis=0) in the pandas.concat function, what type of object is returned?

A. Series
B. DataFrame
C. Mutliindex
D. ndarray

A

A. Series

134
Q

What is the default join type used in the merge() function in Pandas?

A.inner join
B.left join
C.right join
D.Outer join

A

A. Inner join

135
Q

What does the ‘sort’ parameter of the DataFrame.join() method control?
A.Sorting the resulting joined DataFrame by the join key
B.Sorting the columns of the left frame
C.Sorting the columns of the right frame
D.Sorting the index of the resulting joined DataFrame

A

A.

136
Q

Which parameter of the DataFrame.join() method specifies the columns to join on?

A.other
B.on
C.how
D.issuffix

A

B. on

137
Q

Which parameters in the merge() function specifies the column(s) to merge on?

A. left_on

B. right_on

C. on

D. by

E. how

F. suffixes

A

A,B,C

138
Q

What is the default value for the join parameter in the pandas.concat function?

A.inner
B.outer
C.left
D.right

A

B.outer

139
Q

What is the default value for the ‘how’ parameter of the DataFrame.join() method?

A.left
B.right
C.outer
D.inner

A

A. left

140
Q

In a left join operation using merge(), what happens to the unmatched rows from the right DataFrame?
A.They are included in the result with NaN values
B.They are dropped from the result
C.They are duplicated in the result
D.They are excluded from the merge operation

A

A.

141
Q

If the ignore_index parameter is set to True in the pandas.concat function, what happens to the index values along the concatenation axis?

A.They are dropped silently
B.They are replaced with sequential numbers.
C.They are kept as they are.
D.They are sorted in ascending order.

A

B

142
Q

Which method is used to combine DataFrame or named Series objects with a database-style join?

A.concat()
B.join()
C.merge()
D.append(

A

C.merge()

143
Q

In order to visualize data in a pandas DataFrame, you can use:

A.chart() method
B.plot() method
C.visualize() method
D.all of the above

A

B. plot() method

144
Q

To review the distribution of data, the DataFrame plot() method’s kind parameter can be set to:

A.’dist’
B.’hist’
C.’bin’
D.None of the above

A

B.’hist’

145
Q

The named parameter of the DataFrame plot() method to select the type of chart is called:

A.type
B.kind
C.chart
D.none of the above

A

B.kind

146
Q

In order to refine a pandas chart, you can use which package?
A.pychart
B.Matplotlib
C.numpy
D.None of the above

A

B.Matplotlib

147
Q

Which pandas method can be used to generate a chart?

A.chart()
B.visualize()
C.plot()
D.Any of these

A

C.plot()

148
Q

When generating a scatter chart using seaborn, which named parameters must be set?

A.x,y
B.horiz,vert
C.indep,dep
D.None of these

A

A. x,y

149
Q

True or False, Matplotlib statements can be used to refine a chart generated by pandas

A

True

150
Q

What argument(s) can be provided to the pandas plot() method to generate a stacked bar chart?

A. kind=’stacked_bar’
B.kind=’bar’, stacked=True
C.type=’bar’, subtype=’stacked’
D.type=’stacked bar’

A

B.

151
Q

To generate a dual Y axis line chart, which named parameter is passed to the pandas() plot() method?
A. dualy
B. y2
C. secondary_y
D. None of these

A

C. secondary_y

152
Q

The DataFrame plot() method has the named parameter ____________ , which is set to get a particular type of chart.

A.type
B.chart
C.chart_type
D.kind

A

D. kind

153
Q

When generating a histogram with pandas plot(), which named parameter controls the number of bins?

A.bins
B.hiswidth
C.count
D.width

A

A. bins

154
Q

When creating a chart, by default pandas generates a line chart with the DataFrame’s ____ for the X axis.

A

Index

155
Q

When generating a scatter chart using pandas, which named parameters must be set?

A.x,y
B.horiz,vert
C.indep, dep
D.None of these

A

A. x,y