Lesson 10-19 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 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.\n
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

After using the open() function, which method can be used to read a line from a text file?

A.readtext()
B.readline()
C.readlin()
D.readnext()

A

B. readline()

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

The string returned by the readline() method includes which character at the end of the returned string?

A.\n
B.\t
C.double backspace
D.single backspace

A

A.\n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
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
18
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
19
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
20
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
21
Q

The string split() method returns what data type?

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

A

List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
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 repeition body

A

B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
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
24
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
25
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
26
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. All the above

A

D. All the above

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

The pandas type for storing tabular data is called a:

A

DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
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
29
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
30
Q

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

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

A

A. DataFrame

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

What does the DataFrame shape property indicate?

A

The number of rows and columns of the DataFrame

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

If df is a DataFrame, what does len(df) return?

A

The number of rows of df

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
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
34
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
35
Q

What DataFrame method returns its last rows?

A

tail()

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

In order to use pandas in your program, you need to use the ___ statement.

A

import

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

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

A

False, the correct answer is “NumPy float64” instead of “float”

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

What pandas function can be used to read a tabular text file and return a DataFrame?

A

read_csv

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

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

A

False (pandas provides tools for collecting, transforming, and analyzing tabular data)

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

Which DataFrame method returns its first rows?

A

head()

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

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

A

False (read_csv() can be used to read files with data separated by commas or other delimiters such as spaces or tabs)

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

In order to sort a DataFrame without creating a new DataFrame, the parameter specified is:

A

inplace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
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. a list from a series

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

If df is a DataFrame, and ‘colname’ is one of its column names, the expression df[‘colname’] returns:

A

A series

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
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

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

The method to sort a DataFrame is:

A

sort_values()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
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. None of the options
D. Both A & B

A

D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
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. df.loc[‘rowname’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
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
50
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. df.iloc[0]

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

If df is a pandas DataFrame with a column named ‘Sales’, what type of result is returned by df[‘Sales’] ?

A

A Pandas series

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

What DataFrame method returns a sorted DataFrame?

A

sort_values()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
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
54
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
55
Q

For a DataFrame df with a column named ‘Sales’ and a row index named ‘2023’, what expression will access the Sales for 2023?

A.Either of these
B. df[‘Sales’][‘2023’]
C.df.loc[‘2023’][‘Sales’]

A

A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
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. using the .loc[] accessor

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

Which DataFrame method can be used with for, to iterate over the rows of a DataFrame?

A

iterrows()

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

Suppose you have the following DataFrame and field names:

DataFrame name: studentGrades
Field/column Names: student name, quiz1, quiz2, exam1, exam2

Write the python pandas code that will give descriptive analytics (count, mean, standard deviation, min, max, quartiles) for each numerical series in the dataframe.

A

studentGrades.describe()

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

Given the following DataFrame and field/column names write the python pandas code that shows the number of reviews by taster.

DataFrame name: wineReviews
Field/column names in winReviews: country, description, designation, points, price, province, taster_name, title, variety, winery

Don’t define a variable name for this just write the code to show the output

Use bracket selection (not dot notation) to select the field names

A

wineReviews[‘taster_name’].value_counts()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
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
61
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
62
Q

What does the shape attribute of a DataFrame tell you?

A

The number of columns and rows in the Dataframe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
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
64
Q

What is the purpose of the describe() function?

A

Provide summary statistics of a DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
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

A

D.

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

What does the unique() function in pandas do?

A

Returns the unique values in a column

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

What does the head() function in pandas do?

A

Returns the first 5 rows of the DataFrame

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

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

A

Predictive Analytics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
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
70
Q

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

a) df.insert()
b) df.add_column()
c) df.new_column()
d) df.column_insert()

A

a. df.insert()

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

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

A

To dislay the last few rows of data of the DataFrame

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

What does the shape function return for a DataFrame?

A

Total number of rows and columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
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.

74
Q

Which function is used to sort data in pandas?

A

sort_values()

75
Q

How can you set a specific column of a DataFrame as its index?

a) df.index(‘column_name’)
b) df.set_index(‘column_name’)
c) df.index_as(‘column_name’)
d) df.index_set(‘column_name’)

A

B. Using the set_index() function

76
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.

77
Q

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

a) To merge two DataFrames based on a common column
b) To sort the DataFrame based on specified columns
c) Group rows of data based on specified fields

A

c) Group rows of data based on specified fields

78
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.

79
Q

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

A

Ascending order

80
Q

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

A

False

81
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

82
Q

What parameter of the groupby() method is used to determine the groups for grouping a DataFrame in Python?

A

by

83
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.

84
Q

In the sort_values() function, which sorting algorithm is the default choice for the kind parameter?

A

quicksort

85
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.

86
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.

87
Q

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

A

group

88
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.

89
Q

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

A

by

90
Q

What is the default value for the ascending parameter?

A

True

91
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

92
Q

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

A

False

93
Q

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

A

The data types of the columns in the DataFrame

94
Q

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

A

isnull()

95
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.

96
Q

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

A

NumPy NaN

97
Q

What method can be used to locate DataFrame cells with missing data?
A.ismissing()
B.isna()
C.novalue()

A

B. isna()

98
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.

99
Q

Which method is designed to replace missing values in a pandas DataFrame with a specified value?

a) df.replace_na()
b) df.fillna()
c) df.replace_missing()
d) df.null_fill()

A

B. df.fillna()

100
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.

101
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.

102
Q

What is the default value of the inplace parameter in the replace() function?

A

False

103
Q

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

A

Mean Replacement

104
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.

105
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)

A

F.

106
Q

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

A

None

107
Q

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

a) method
b) strategy
c) fill_type
d) mode

A

A. method

108
Q

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

a) old_value
b) target
c) to_replace
d) substitute

A

C. to_replace

109
Q

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

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

A

B. apply()

110
Q

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

A

B.astype()

111
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.

112
Q

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

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

A

B.

113
Q

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

A

the duplicated() method

114
Q

Which can be used to see if a column has unique values?

A

the is_unique property

115
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.

116
Q

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

A

split()

117
Q

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

A

True

118
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.

119
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.

120
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.

121
Q

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

a) pd.cut()
b) pd.label()
c) pd.bucket()
d) pd.range()

A

A. pd.cut()

122
Q

Which pandas Series method generate the set of unique values in a Series?

A

unique()

123
Q

Which pandas method can create numeric values?

A

to_numeric()

124
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()

125
Q

Which pandas method can create Timestamp values?

A

to_datetime()

126
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.

127
Q

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

A

False

128
Q

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

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

A

A. function

129
Q

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

A

str.split()

130
Q

Inter-field validity checks can be implemented with
A. DataFrame filter expression
B. the DataFrame apply()
C. Both of these

A

C.

131
Q

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

a) find_duplicates()
b) duplicated()
c) dup_rows()
d) repeat_rows()

A

b. duplicated()

132
Q

What pandas Series property indicate the type used for the data?

A

dtype

133
Q

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

a) df[‘column_name’].type()
b) df[‘column_name’].cast()
c) df[‘column_name’].astype()
d)df[‘column_name’].change_type()

A

c. astype()

134
Q

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

A. Melt()
B.transpose()
C. pivot()
D. All the above

A

D.

135
Q

Which Series property indicates if its values are distinct?

a) is_distinct
b) is_unique
c) unique
d) distinct

A

B. is_unique

136
Q

What keyword begins the definition of a lambda function?

A

lambda

137
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. It specifies the axis to concatenate along.

138
Q

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

a) merge_type
b) join_type
c) how
d) method

A

C. how

139
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

140
Q

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

A

on

141
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.

142
Q

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

A

Left

143
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

144
Q

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

A

axis

145
Q

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

A

Series

146
Q

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

A

Inner join

147
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.

148
Q

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

A

On

149
Q

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

A. left_on
B. right_on
C. on
D. None of the Above
E. All the above

A

left_on, right_on, on

150
Q

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

a) ‘outer’
b) ‘inner’
c) ‘left’
d) ‘right’

A

A. ‘outer’

151
Q

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

A

left

152
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.

153
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.

154
Q

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

A

merge()

155
Q

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

a) df.plot()
b) df.visualize()
c) df.show_graph()
d) df.chart()

A

A. the plot() method

156
Q

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

a) ‘hist’
b) ‘table’
c) ‘text’
d) ‘details’

A

A. ‘hist’

157
Q

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

A

kind

158
Q

The default chart provided by pandas DataFrame is a:

A

line chart

159
Q

In order to refine a pandas chart, you can use which package?

A

Matplotlib

160
Q

A chart type for reviewing a potential relationship between two variables is:

A

scatter

161
Q

Which pandas method can be used to generate a chart?

A

plot()

162
Q

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

A

x,y

163
Q

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

A

True

164
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. kind=’bar’, stacked=True

165
Q

Which package can be used with seaborn to refine the generated chart?

A

Matplotlib

166
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.

167
Q

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

A

kind

168
Q

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

A

bins

169
Q

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

A

index

170
Q

Describe Descriptive Analytics

A

Tell us what has happend or what is happening

171
Q

Describe Predictive Analytics

A

Tells us what is likely to happen next

172
Q

Describe Prescriptive Analytics

A

Tells us what to do based on the analysis

173
Q

Is shape an attribute or method

A

attribute

174
Q

Is size an attribute or method

A

attribute

175
Q

Is head() an attribute or method

A

method

176
Q

str.replace() is an attribute or method

A

method

177
Q

dtypes is an attribute or method

A

attribute

178
Q

read_csv() is an attribute or method

A

method

179
Q

Is the map() method compatiable with: Series, DataFrames, or Both

A

Only Series

180
Q

Is the apply() method compatiable with: Series, DataFrames, or Both

A

Both: Series & DataFrame

181
Q

Is the applymap() method compatiable with: Series, DataFrames, or Both

A

Only DataFrames