## Table of Contents

#### All Weeks Data Analysis with Python Coursera Quiz Answers

## Week 01: Importing Datasets

### Practice Quiz: Understanding the Data

Q1. Each column contains a:

**attribute or feature**- different used car

Q2. How many columns does the dataset have?

**26**- 205

### Practice Quiz: Python Packages for Data Science

Q1. What description best describes the library Pandas?

- Includes functions for some advanced math problems as listed in the slide as well as data visualization.
- Uses arrays as their inputs and outputs. It can be extended to objects for matrices, and with a little change of coding, developers perform fast array processing.
**Offers data structure and tools for effective data manipulation and analysis. It provides fast access to structured data. The primary instrument of Pandas is a two-dimensional table consisting of columns and rows labels which are called a DataFrame. It is designed to provide an easy indexing function.**

Q2. What is a Python library?

- A file that contains data.
**A collection of functions and methods that allows you to perform lots of actions without writing your code.**

### Practice Quiz: Importing and Exporting Data in Python

Q1. What does the following method do to the data frame? **df** : **df.head(12)1 point**

**Show the first 12 rows of dataframe.**- Shows the bottom 12 rows of dataframe.

Q2. What task does the following lines of code perform?

path=’C:\Windows\…\ automobile.csv’

df.to_csv(path)

**Exports your Pandas dataframe to a new csv**file, in the location specified by the variable path.- Loads a csv file.

### Practice Quiz: Getting Started Analyzing Data in Python

Q1. To enable a summary of all the columns, what must the parameter** include** be set to for the method described?

**df.describe(include=“all”)**- df.describe(include=“None”)

### Graded Quiz: Importing Datasets

Q1. What do we want to predict from the dataset?

- price
- colour
**make**

Q2. What library is primarily used for machine learning

- scikit-learn
- Python
**matplotlib**

Q3. We have the list headers_list:

headers_list=['A','B','C']

We also have the data frame df that contains three columns, what is the correct syntax to replace the headers of the data frame df with values in the list **headers_list?**

**df.columns = headers_list**- df.head()
- df.tail
**()**

Q4. What attribute or method will give you the data type of each column?

- describe()
- columns
**dtypes**

Q5. How would you generate descriptive statistics for all the columns for the data frame **df?**

- df.describe()
**df.describe(include = “all”)**- df.info

### Practice Quiz: Dealing with Missing Values in Python

Q1. How would you access the column ”body-style” from the data frame **df?**

**df[ “body-style”]**- df==”bodystyle”

Q2. What is the correct symbol for missing data?

**nan**- no-data

### Practice Quiz: Data Formatting in Python

Q1. How would you rename the column “city_mpg” to “city-L/100km”?

**df.rename(columns={”city_mpg”: “city-L/100km”}, inplace=True)**- df.rename(columns={”city_mpg”: “city-L/100km”})

### Practice Quiz: Data Normalization in Python

Q1. Which of the following is the correct formula for z -score or data standardization?

Q2. What is the maximum value for feature scaling?

**1**

### Practice Quiz: Turning categorical variables into quantitative variables in Python

Q1. Consider the column ‘diesel’; what should the value for Car B be?

**1**

### Graded Quiz: Data Wrangling

Q1. What task do the following lines of code perform?

```
avg=df['horsepower'].mean(axis=0)
df['horsepower'].replace(np.nan, avg)
```

- calculate the mean value for the
**‘horsepower’**column and replace all the NaN values of that column by the mean value - nothing; because the parameter
**inplace**is not set to true **replace all the NaN values with the mean**

Q2. Consider the dataframe df; convert the column df[“city-mpg”] to df[“city-L/100km’] by dividing 235 by each element in the column ‘city-mpg’.

Q3. What data type is the following set of numbers?** 666, 1.1,232,23.12**

Q4. Consider the two columns ‘horsepower’, and ‘horsepower-binned’; from the data frame **df**; how many categories are there in the ‘horsepower-binned’ column?

**3**

## Week 3 – Practice Quiz: Descriptive Statistics

Q1. Consider the following scatter plot; what kind of relationship do the two variables have?

**positive linear relation**ship- negative linear relationship

Q2. Which of the following tables representing a number of drive wheels, body style, and the price is a Pivot Table?

### Graded Quiz: Exploratory Data Analysis

Q1. Consider the dataframe **df**; what method provides the summary statistics?

**describe()**- head()
- tail()

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

- 10 x 100
**10×10**- 100×100

Q3. If the p-value of the Pearson Correlation is 1, then …

- The variables are correlated
- The variables are not correlated
**None of the above**

Q4. Consider the following dataframe:

`1df_test = df[['body-style', 'price']]`

The following operation is applied:

`1df_grp = df_test.groupby(['body-style'], as_index=False).mean()`

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

**The average price for each body style**- The average price
- The average body style

Q5. What is the Pearson Correlation between variables X and Y, if X=-Y?

**-1**- 1
- 0

**All Quiz Answers of multiple Specializations or Professional Certificates programs**:

Course 1: What is Data Science?

Course 2: Tools for Data Science

Course 3: Data Science Methodology

Course 4: Python for Data Science, AI & Development

Course 5: Python Project for Data Science

Course 6: Databases and SQL for Data Science with Python

Course 7: Data Analysis with Python