Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 Before we run our correlations and regressions, we need to clean our data and prepare it for different types of regressions. All of the
1 Before we run our correlations and regressions, we need to clean our data and prepare it for different types of regressions. All of the changes should be made in and saved as the `avocados` dataframe. First, remove all rows for regions at the city and state level and the entire United States. Hint: look at the `region` column for values that do not indicate a region related to city or state; there are eight regions that should remain. ### Next, create a new variable called `type_bin` to convert values in the `type` columns into binary values. Organic avocados should be labeled as `1`. The updated dataframe should include only the following six columns: `Year`, `Month`, `AveragePrice`, `plu4225`, `type_bin`, and `region` (you will use `plu4225` later). ### Finally, save the first five rows of the updated dataframe as Q1. - Your solution should be a 5x6 dataframe assigned to Q1. In the Console Window the output should look something like this: ``` Year Month AveragePrice type_bin region 1 [value] [value] [value] [value] [value] 2 [value] [value] [value] [value] [value] 3 [value] [value] [value] [value] [value] 4 [value] [value] [value] [value] [value] 5 [value] [value] [value] [value] [value] ```
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started