1/34
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
How many rows are in the Series returned by the following expression? Assume that ts is a pandas DataFrame and state and sales are columns in the ta DataFrame. ts.groupby(state") ('sales 1. transform('sum")
a) The number of unique values in the state column in the ts Dataframe
b) The number of unique values in the sales column in the ts Dataframe
c) The number of unique combinations of state and sales in the Cs Dataframe
d) The number of rows in the ts Dataframe
d) The number of rows in the ts Dataframe
When applied to a Series of Boolean values (True and False values), which of the following methods or method chains will calculate the proportion of True values in the Series of Boolean values?
a).istrue.mean ()
b)mean ()
c)sum () - mean ()
d)sum ()
b)mean ()
Which of the following is true about logistic regression?
a.)It finds the coefficients that minimize the sum of squared errors
b) It finds the coefficients that minimize the sum of squared errors plus a constant multiplied by the sum of the absolute values of the coefficients
c) The logistic regression equation produces numbers that are converted to a scale of 0 to 1 by the logistic function so that they may be interpreted as probabilities
d) The logistic regression equation produces numbers that are the natural logarithms of the probabilities that the model is statistically significant
c) The logistic regression equation produces numbers that are converted to a scale of 0 to 1 by the logistic function so that they may be interpreted as probabilities
What will df. groupby ("category") ["sales"]. sum () do?
a) Count the number of unique sales values in each category group
b) Divide the DataFrame into groups by each unique combination of category and sales and then report the number of rows in each group
c) Return the total count of sales across the entire DataFrame
d) Divide the DataFrame into groups by each unique value of category and then sum the sales within each group
d) Divide the DataFrame into groups by each unique value of category and then sum the sales within each group
Your dataset contains a column called support level that has 3 unique values: do not support, neutral, and support. How many numeric columns will be created from the support_Level column by the default dummy-encoding process used by the statsmodels smf. ols () function?
a) 1
b) 2
c) 3
d) 4
b) 2
In the statsmodels summary output from a logistic regression analysis, what units are the coefficients expressed in?
a) They are expressed in units of the natural logarithm of the odds of the positive class
b) They are expressed in maximum likelihood units
c) They are expressed in binary units
d) They are expressed in z-score units: each coefficient is subtracted from the mean coefficient and then divided by the standard deviation of the coefficients
a) They are expressed in units of the natural logarithm of the odds of the positive class
Which of the following pandas methods is used to show the unique values in a pandas Series, along with the counts of each unique value?
a) .nunique()
\b) .unique_counts()
c) .unique()
d) .value_counts()
d) .value_counts()
What is plotnine?
A. a spinoff of the popular Star Wars series, "Deep Space 9"
b. A python package that implements the "grammar of graphics" approach to making plots, an approach popularized in R's ggplot2 package
c. A python package used to make plots that is a clone of the matplotlib package, which is based on matlab's plotting tools
d. A python package used for logistic regression
b. A python package that implements the "grammar of graphics" approach to making plots, an approach popularized in R's ggplot2 package
In logistic regression, how are the coefficients of the logistic regression equation determined?
a) The logistic regression procedure finds the coefficients that minimize the sum of squared errors
b) The logistic regression procedure finds the coefficients that minimize the sum of squared errors plus a constant multiplied by the sum of squared coefficients
C) The logistic regression procedure finds the coefficients that are equal to the log odds of the positive class
d) The logistic regression procedure finds the coefficients that maximize the likelihood derived from the model of the set of observed outcomes
d) The logistic regression procedure finds the coefficients that maximize the likelihood derived from the model of the set of observed outcomes
Which pandas method can be used to separate a DataFrame into subsets based on the unique values in one or more columns, in preparation for applying aggregation operations to each of the subsets separately?
a. groupby ()
b. loc (]
c. transform ()
d. subset ()
a. groupby ()
11) How many rows are in the Series returned by the following expression? Assume that de 1. i a pandas Dataframe and observations and species are columns in the dt__1 Dataframe: di_1. groupby ('species") ('observations" 1 -sum ()
a) The number of rows in the dE Daterrame
b) The count of unique values in the observations column of the di!_1 Dataframe
c) The count of unique values in the species column of df_1
d) The count of unique combinations of species and observations in the df_1 DataFrame
c) The count of unique values in the species column of df_1
The first DataFrame above was used to produce the second DataFrame above, without assigning intermediate results to any variables. Which of the following methods was likely included in the method chain used to create the second DataFrame from the first one?
a) transform()
b) groupby ()
c) pivot ()
d) melt ()
d) melt ()
13) The first DataFrame above was used to produce the second Dataframe above, without assigning method chain used to create the second Dataframe from the first one?
a) mean ()
b) query ()
c) remove_column ()
d) reset_index()
b) query ()
14) According to the Marginal Effects table above, which statement below is true regarding Titanic passengers?
a) We are 95% confident that in the population the probability of a male passenger surviving was
-0.399 to -0.336, on average
b) Passengers with first-class tickets had the lowest probability of survival, among all the ticket classes, all else held equal
C) In the sample, the probability of a male passenger surviving was 0.016 less than the probability of a female passenger surviving, on average, all else held equal
d) We are 95% confident that in the population the probability of a male passenger surviving was 0.336 to 0.399 less, on average, than the probability of a female passenger surviving
d) We are 95% confident that in the population the probability of a male passenger surviving was 0.336 to 0.399 less, on average, than the probability of a female passenger surviving
15) According to the Marginal Effects table above, which statement below is true regarding Titanic
a) Males had a higher probability of survival than females
b) Older passengers had a higher probability of survival
c) Younger passengers had a higher probability of survival
d) Passengers who had third-class tickets had the highest probability of survival
c) Younger passengers had a higher probability of survival
The following code is syntactically correct and runs without errors: (boxscores
assign (team_pts = boxscores-groupby (('date', 'tean']) ['pts'1. transform(' sum*))
query ('team_pts < 100")
groupby ('player')
(('pts']1
mean ()
nlargest(n = 10, columns = 'pts', keep = 'all')
16) How would you best describe what the above code is doing?
a) calculating the top 10 highest scoring games by players when their team scored fewer than 100 points
b) calculating the top 10 player scoring averages, only including games in which the player's team scored fewer than 100 points
c) creating a new column with a list of dates on which the team scored fewer than 100 points
d) creating a top-10 list of scoring averages for players who scored at least 100 points for their team during the season
b) calculating the top 10 player scoring averages, only including games in which the player's team scored fewer than 100 points
17) To merge the DataFrames d1 and df 2 on a column named ID, keeping only the rows for which there is a matching value in the ID column of both DataFrames, which method should you use?
a) df1.merge (df2, match="ID", how="both")
b) df1.merge (df2, on="ID", how="inner")
c) df1 merge (af2, on="ID", how="outer")
d) dfl.merge (df2, match="ID", how="outer")
b) df1.merge (df2, on="ID", how="inner")
18) Which of the following is a pandas method that may be used to sort a Series or DataFrame? a)
a) .sort ()
b) .sort_values ()
c) .reorder ()
d) .set_order ()
b) .sort_values ()
19) Which of the methods below may be used to filter a pandas DataFrame based on various logical criteria, such as keeping all rows where the value in the age column is greater or equal to 18?
a) . loc(]
b) . subset ()
c) . iloc(]
d) .apply_ criteria ()
a) . loc(]
20) The first DataFrame above was used to produce the second DataFrame above, without assigning intermediate results to any variables. Which of the following was likely used to create the second DataFrame from the first one?
a) new_column ()
b) .first_letter()
c).loc []
d) The str accessory
d) The str accessory
21) The first DataFrame above was used to produce the second DataFrame above. Which of the following code segments was likely used as part of creating the second DataFrame from the first one?
a) df. query ('df ['gender'] == "f"')
b) df. loc (gender == 'F')
c) df. sort_values (by = 'test_avg', ascending = False)
d) df. query ('gender == "f"')
d) df. query ('gender == "f"')
22) Which of the following lines of code would return a variety of descriptive statistics for the numeric values in a column named total_ sales in a Dataframe named store_58?
a) store_58.descriptive_ stats (col = 'total_sales')
b) desc_stats (df = 'store_58', col = 'total _sales')
c) store_58 ('total_sales'].describe ()
d) store_58.total_sales.stats ()
c) store_58 ('total_sales'].describe ()
23) How would you best describe what the code above is doing?
a) finding the player who scored at least 30 points and had at least 10 rebounds in the fewest number of games
b) calculating the minimum number of minutes played in a game by a player who scored at least 30 points and had at least 10 rebounds
c) 30 points and had at least 10 rebounds
d) making sure that the players who had games of at least 30 points and 10 rebounds, didn't score a minimum
of 30 points and make a minimum of 10 reboundsb) calculating the minimum number of minutes played in a game by a player who scored at least 30 points and had at least 10 rebounds24) How would you best describe what the code above is doing?
a) showing the games with the highest overall three point percentage by all players who
played in the game
b) eliminating from boxscores all the rows for which the player took at least 10 three point shots
and had a three point percentage of less than 0.5
c) displaying the players with the top three point shooting percentages for the season
d) showing, in sorted order, three point percentage per player game for player-games in which
the player took at least 10 three point shots
d) showing, in sorted order, three point percentage per player game for player-games in which
the player took at least 10 three point shots25) Which of the following may be used to create a new column in a DataFrame?
a) The value_counts() method
b) The new_column() method
c) The assign() method
d) Use the DataFrame update() method with the newcol parameter set to the new column's namec) The assign() method26) In Pandas, what is the purpose of the dt and str accessors?
a) They allow datetime and string columns to be accessed with the vectorized loc[] method
b) They allow datetime and string objects within the same Series to be accessed as numeric types
c) They allow datetime and string methods to be applied to all the individual elements of a Series
d) They specify the type of the values to be returned by pandas constructorsc) They allow datetime and string methods to be applied to all the individual elements of a Series27) According to the linear regression summary output, which independent variables have a statistically-significant relationship to the dependent variable at the 0.05 level?
a) x2 and x3
b) x1 and x4
c) x1, x2, and x3
d) x1, x2, x3, and x4
b) x1 and x4
28) According to the linear regression summary output, what proportion of the variation in the dependent variable can be explained by variation in the independent variables?
a) 0.132
b) 0.563
c) 0.3619
d) 0.895
b) 0.563
29) According to the linear regression summary output, how can we best describe the relationship between x4 and the dependent variable in the population?
a) We are 95% confident that for every one-unit increase in x4 the value of the dependent variable increases by 2.036 to 2.596, on average, when the other variables are held constant
b) We cannot make any conclusions about the population because the regression was run on a sample
c) For every 1-unit increase in x4 the value of the dependent variable increases by 0.143, on average, when the other variables are held constant
d) Since the std err of x4 is 0.143 we know that 14.3% of the variability in the dependent variable can be explained by variability in x4
a) We are 95% confident that for every one-unit increase in x4 the value of the dependent variable increases by 2.036 to 2.596, on average, when the other variables are held constant
30) Which pandas method may be used to select a specified number of rows at random from a DataFrame?
a) .random_select()
b) .sample()
c) .select()
d) .random_seed()
b) .sample()
31) What is the parameter setting used to indicate that a pandas sorting operation should sort the data from highest to lowest?
a) sort_order = 'desc'
b) order = 'descending'
c) dir = high_low
d) ascending = False
d) ascending = False
32) In python, what happens when a Boolean array (array of True and False values) is used in a mathematical calculation, such as calculating a sum?
a) An error message will be presented. Boolean values are not numeric, and may not be used in a mathematical calculation
b) Random numbers will be used in the calculation, but there will not be an error message. This produces a mistake that is difficult to debug
c) The calculation will treat True values as binary zeros and False values as binary eights
d) The True values are treated as ones and the False values are treated as zeros in the calculation
d) The True values are treated as ones and the False values are treated as zeros in the calculation
33) In a linear regression model summary output, what does the adjusted R² metric represent?
a) The proportion of variance in the dependent variable that can be explained by the model
b) The mean of the absolute values of the errors
c) The mean of the squared errors
d) The proportion of variance in the residuals that can be explained by the model
a) The proportion of variance in the dependent variable that can be explained by the model
34) In a linear regression model summary output, what is the conceptual meaning of a p-value?
a) The proportion of variance in the dependent variable that can be explained by the model
b) The probability of getting a coefficient value as large or larger than the coefficient for the sample if the true coefficient in the population is zero
c) The mean of the squared errors, if the true population error is zero
d) The proportion of variance in the residuals that can be explained by the model
b) The probability of getting a coefficient value as large or larger than the coefficient for the sample if the true coefficient in the population is zero
35) Which of the following plotnine code segments was likely used in the creation of the plot shown above?
a) + geom_scatter()
b) + geom_smooth(method = 'lm', se = False)
c) + labs(title = 'Vehicle Weight vs Miles Per Gallon', x = 'Species', y = 'Mass (g)')
d) + geom_histogram()
b) + geom_smooth(method = 'lm', se = False)