Are you looking for Data Analysis with Python Exam Answers by Cognitive Class? If yes, this article will help you find all the questions and answers asked in the Cognitive Class Data Analysis with Python Quiz. I have followed this article to solve all the questions for this exam.

Here you will learn how to analyze data using Python. This course will take you from the basics of Python to exploring many different types of data. You will learn how to prepare data for analysis, perform simple statistical analyses, create meaningful data visualizations, predict future trends from data, and more!

Organization | Cognitive Class |

Trainers | Joseph Santarcangelo, Mahdi Noorian |

Eligibility | Anyone who wants to use Python to analyze data |

Level | Intermediate |

Duration | 3hr |

Language | English |

Price | Free |

Certificate | Yes |

Data Analysis with Python | Click Here |

## Cognitive Class – Data Analysis with Python Answers

### Module 1: Introduction

**1. What does CSV stand for?**

**2. In the data set what represents an attribute or feature?**

**3. What is another name for the variable that we want to predict?**

**4. What is the command to display the first five rows of a dataframe df?**

**5. what command do you use to get the data type of each row of the dataframe df?**

**6. How do you get a statistical summary of a dataframe df?**

**7. If you use the method describe() without changing any of the arguments you will get a statistical summary of all the columns of type object?**

### Module 2: Data Wrangling

**1. Consider the dataframe “df” what is the result of the following operation df[‘symbolling’] = df[‘symbolling’] + 1?:**

**2. Consider the dataframe “df”, what does the command df.rename(columns={‘a’:’b’}) change about the dataframe “df”**

**3. Consider the dataframe “df” , what is the result of the following operation df[‘price’] = df[‘price’].astype(int) ?**

**4. Consider the column of the dataframe df[‘a’]. The colunm has been standardized. What is the standard deviation of the values, i.e the result of applying the following operation df[‘a’].std() :**

**5. Consider the column of the dataframe df[‘Fuel’], with two values ‘gas’ and’ diesel’. What will be the name of the new colunms pd.get_dummies(df[‘Fuel’]) ?**

**6. What are the values of the new columns from part 5 a)**

### Module 3: Exploratory Data Analysis

**1. Consider the dataframe “df”. Which method provides the summary statistics?**

**2. Consider the following dataframe:**

df_test = df[‘body-style’, ‘price’]

The following operations is applied:

df_grp = df_test.groupby([‘body-style’], as_index=False).mean()

What are resulting values of df_grp[‘price’]:

**3. Correlation implies causation :**

**4. What is the minimum possible value of Pearson’s Correlation :**

**5. What is the Pearson correlation between variables X and Y, if X=Y:**

### Module 4: Model Development

**1. Let X be a dataframe with 100 rows and 5 columns, let y be the target with 100 samples,assuming all the relevant libraries and data have been imported, the following line of code has been executed:**

LR = LinearRegression()

LR.fit(X, y)

yhat = LR.predict(X)

How many samples does yhat contain :

**2. What value of R^2 (coefficient of determination) indicates your model performs best ?**

**3. What statement is true about Polynomial linear regression**

**4. The larger the mean square error, the better your model has performed**

**5. Assume all the libraries are imported, y is the target and X is the features or dependent variables, consider the following lines of code:**

Input = [(‘scale’, StandardScaler()), (‘model’, LinearRegression())]

pipe = Pipeline(Input)

pipe.fit(X,y)

ypipe = pipe.predict(X)

What have we just done in the above code?

### Module 5: Model Evaluation

**1. In the following plot, the vertical access shows the mean square error andthe horizontal axis represents the order of the polynomial. The red line represents the training error the blue line is the test error. What is the best order of the polynomial given the possible choices in the horizontal axis?**

**2. What is the use of the “train_test_split” function such that 40% of the data samples will be utilized for testing, the parameter “random_state” is set to zero, and the input variables for the features and targets are_data, y_data respectively.**

**3. What is the output of cross_val_score(lre, x_data, y_data, cv=2)?**

**4. What is the code to create a ridge regression object “RR” with an alpha term equal 10**

**5. What dictionary value would we use to perform a grid search for the following values of alpha: 1,10, 100. No other parameter values should be tested**

### Data Analysis with Python Final Exam Answers

**1. What does the following command do:**

df.dropna(subset=[“price”], axis=0)

**2. How would you provide many of the summery statistics for all the columns in the dataframe “df”:**

**3. How would you find the shape of the dataframe df**

**4. What task does the following command to df.to_csv(“A.csv”) perform**

**5. What task does the following line of code perform:**

df[‘peak-rpm’].replace(np.nan, 5,inplace=True)

**6. What task does the following line of code perform:**

df[‘peak-rpm’].replace(np.nan, 5,inplace=True)

**7. How do you “one hot encode” the column ‘fuel-type’ in the dataframe df**

**8. What does the vertical axis in a scatter plot represent**

**9. What does the horizontal axis in a scatter plot represent**

**10. If we have 10 columns and 100 samples how large is the output of df.corr()**

**11. what is the largest possible element resulting in the following operation “df.corr()”**

**12. if the Pearson Correlation of two variables is zero:**

**13. if the p value of the Pearson Correlation is 1:**

**14. What does the following line of code do: lm = LinearRegression()**

**15. If the predicted function is:**

Yhat = a + b1 X1 + b2 X2 + b3 X3 + b4 X4

The method is

**16. What steps do the following lines of code perform:**

Input=[(‘scale’,StandardScaler()),(‘model’,LinearRegression())]

pipe=Pipeline(Input)

pipe.fit(Z,y)

ypipe=pipe.predict(Z)

**17. What is the maximum value of R^2 that can be obtained**

**18. We create a polynomial feature as follows “PolynomialFeatures(degree=2)”, what is the order of the polynomial**

**19. You have a linear model the average R^2 value on your training data is 0.5, you perform a 100th order polynomial transform on your data then use these values to train another model, your average R^2 is 0.99 which comment is correct**

**20. You train a ridge regression model, you get a R^2 of 1 on your training data and you get a R^2 of 0 on your validation data, what should you do:**

### Wrap Up

I hope this article would be helpful for you to find all the “Cognitive Class Answers: Data Analysis with Python Quiz Answers.” If this article helped you learn something new for free, then share it on social media, let others know about this, and check out the other free courses we have shared here.