Question: (python) Step (1): Import the pandas, numpy, and seaborn libraries. import pandas as pd import numpy as np import seaborn as sns Step (2): Use

(python)

Step (1): Import the pandas, numpy, and seaborn libraries.

import pandas as pd

import numpy as np

import seaborn as sns

Step (2): Use the code line below to load the "iris" dataset and store it as a data frame.

iris = sns.load_dataset('iris')

Step (3): Drop the "species" column in the iris data frame.

sepal_length sepal_width petal_length petal_width
0 5.1 3.5 1.4 0.2
1 4.9 3 1.4 0.2
2 4.7 3.2 1.3 0.2
3 4.6 3.1 1.5 0.2
4 5 3.6 1.4 0.2

Step (4): Add two more columns to the iris data frame, "sepal_sum" and "petal_sum". The "sepal_sum" is the sum of the values from the "sepal_length" and "sepal_width" columns. On the other hand, The "petal_sum" is the sum of the values from the "petal_length" and "petal_width" columns.

sepal_length sepal_width petal_length petal_width sepal_sum petal_sum
0 5.1 3.5 1.4 0.2 8.6 1.6
1 4.9 3 1.4 0.2 7.9 1.6
2 4.7 3.2 1.3 0.2 7.9 1.5
3 4.6 3.1 1.5 0.2 7.7 1.7
4 5 3.6 1.4 0.2 8.6 1.6

Step (5): Create a new data frame with the summary stats for the iris dataset. For this summary, compute each column's mean, standard deviation, and minimum and maximum values.

Note: Decide the final layout for the data frame. Use as a reference the below example.

mean std min max
sepal_length 5.843333 0.825301 4.3 7.9
sepal_width 3.057333 0.434411 2 4.4
sepal_sum 8.900667 0.886303 6.8 11.7
petal_length 3.758 1.759404 1 6.9
petal_width 1.199333 0.759693 0.1 2.5
petal_sum 4.957333 2.499316 1.2 9.2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!