Home / Expert Answers / Computer Science / python-jupyter-notebook-nbsp-only-using-numpy-pandas-and-matplotlib-pyplot-please-help-with-th-pa355

(Solved): Python, Jupyter Notebook ** only using numpy, pandas, and matplotlib.pyplot Please help with th ...



Python, Jupyter Notebook ** only using numpy, pandas, and matplotlib.pyplot

Please help with this problem. ** PLEASE do not simply copy from another post. NONE of the answers are correct.**

 

Part 10: Grouping by Clarity
In this part, you will calculate the mean price and carat size for each level of the variable cl

 

Data used:

https://github.com/amankharwal/Website-data/blob/master/diamonds.csv

import pandas as pd
df = pd. read_csv (datasets/diamonds.csv, index_col=0)
df.head()
carat
cut
color
clarity
1
0.23
2 0.21

Part 10: Grouping by Clarity In this part, you will calculate the mean price and carat size for each level of the variable clarity. Create a markdown cell that displays a level 2 header that reads: "Part 10: Grouping by Clarity". Add text explaining that you will create a grouped DataFrame displaying the mean price and carat size for each clarity level. Create a new DataFrame named gb_clarity as follows: Select the clarity, price, and carat columns from diamonds, group the result by clarity, and then calculate the grouped means. Display the resulting DataFrame. Create a markdown cell explaining that you will now use bar charts to graphically display the information from the DataFrame above. Create a figure containing two side-by-side bar charts. Each chart should have a bar for every level of clarity. The left chart should display the mean price for each level, and the right chart should display the mean carat size for each level. Create the figure according to the following specifications: Set the figure size to [12,4]. Label the x-axes as "Clarity". Label the y-axes "Mean Price" and "Mean Carat Size". The title should be "Mean Price by Clarity " and "Mean Carat Size by Clarity". The edgecolor in each plot should be set to black. The color of the bars in each plot should be set according to clarity_pal. Display the plot using plt.show(). 9 import pandas as pd df = pd. read_csv ("datasets/diamonds.csv", index_col=0) df.head() carat cut color clarity 1 0.23 2 0.21 3 0.23 4 0.29 5 0.31 ?? Ideal Premium Good Premium Good E E E 1 J S12 SI1 VS1 VS2 SI2 61.5 59.8 56.9 62.4 63.3 depth table 55.0 61.0 65.0 58.0 58.0 326 326 327 334 335 price 3.95 3.89 4.05 4.20 4.34 X 3.98 3.84 4.07 4.23 4.35 y 2.43 2.31 2.31 2.63 2.75 Z


We have an Answer from Expert

View Expert Answer

Expert Answer


ANSWER: Python Code: # %% import pandas as pd # importing import numpy as np import matplotlib.pyplot as plt import os, sys # %% path_of_data os.path.join(sys.path = pd.read_csv(path_of_data) df = d
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe