Question: Python homework Import the following packages using the standard aliases: numpy, pandas, and matplotlib.pyplot. No other packages should be used in this project. Part 5:
Python homework Import the following packages using the standard aliases: numpy, pandas, and matplotlib.pyplot. No other packages should be used in this project.

Part 5: Regional Counts and Means Each automobile in this dataset was manufactured in one of three regions: Asia, Europe, or The United States. In this problem, we will calculate the number of observations associated with each region, as well as regional means for mpg, cyl, and wt. Your code in Part 5 should use DataFrame and array operations and should not include any loops. Use np. unique() to obtain an array of unique values appearing in the region column of auto. Store the resulting array in a variable named regions. Print this array. Use boolean masking to create three new DataFrames named asia_auto, eur_auto, and usa_auto. Each of these new DataFrames should contain the rows of auto associated with one of the values of region. Use len() or the shape attribute to determine the number of rows in each of the new DataFrames. Print the results in the following formats, with the values replacing the xxxx characters left-aligned. Number of cars manufactured in Asia: xxxx Number of cars manufactured in Europe: xxxx Number of cars manufactured in USA: xxxx 3 Create three new arrays named asia_means, eur_means, and usa_means. Each array should have three elements, which should be the average values of mpg, cyl, and wt for the relevant region. You can use either the function np.mean() or the DataFrame method mean() to calculate these arrays. Use the arrays to create a new DataFrame named mean_df. The DataFrame should have three columns named mpg, cyl, and wt. Each row of this DataFrame should represent one of the three regions, and the index for the DataFrame should be set to indicate the name of the region using the previously created regions array. Display mean_df without using the print() function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
