Question: Perform the tasks and answer the questions using Python code. Display results when applicable. Take screenshots of your work. To start performing each task, import

Perform the tasks and answer the questions using Python code. Display results when applicable. Take screenshots of your work.

To start performing each task, import the libraries (pandas, matplotlib.pyplot and Seaborn) you will need to work with data and plot the graphs.

Load the "diamonds" dataset from the Seaborn package.

The explanation for each column is as given below:

1) price - price in US dollars ($326  $18,823)

2) carat - weight of the diamond (0.25.01)

3) cut - quality of the cut (Fair, Good, Very Good, Premium, Ideal)

4) color - diamond colour, from J (worst) to D (best)

5) clarity - a measurement of how clear the diamond is (I1 (worst), SI2, SI1, VS2, VS1, VVS2, VVS1, IF (best))

6) x - length in mm (010.74)

7) y - width in mm (058.9)

8) z - depth in mm (031.8)

9) depth - total depth percentage = z / mean(x, y) = 2 * z / (+ y) (4379)

10) table - width of top of diamond relative to widest point (4395)

Task 1

i) Load the "diamonds" dataset from the Seaborn package to an object.

ii) Find the datatype of the object into which you have loaded the "diamonds" dataset.

iii) View the top 5 and bottom 5 rows of the data.

iv) Get the dimensions of the data. Find the number of rows and columns in the data.

v) Display the structure of the data  all column names along with their data types.

vi) Display the summary statistics of all the columns in your data.

Hint: Explore the functions available in pandas dataframe to perform tasks iii-vi. 



Task 2

Using Seaborn, plot a histogram for the "price' field. Also, display the curve line on the histogram that depicts the shape of the distribution.



Task 3

Visually show how many types of cuts are there in the data and how many records we have for each type of cut (use Seaborn). Verify the plot with actual values (use functions in pandas).



Task 4

Visually display the mean price of the diamonds based on the different types of cuts. Which type of cut has highest average price (use Seaborn)? Verify the plot outputs with actual values.



Task 5

Visually display the number of records we have in the diamond data corresponding to a particular cut and color (use Seaborn). Verify with actual values. (Hint: Use the crosstab function available in pandas). 



Task 6

Using lineplot, find the average carat for diamonds of different cut and color. Verify the display with actual values. (Hint: use groupby)



Task 7

Using scatterplot, find the relation between:

i) Carat and price of diamonds

ii) Carat and x dimension

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To address the tasks in the provided question well perform each of the tasks using Python and the specified libraries pandas matplotlib and seaborn Be... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!