11.7k views
4 votes
Notice that the iris.target array contains 3 different labels. Create a plot that you think is interesting using the data from the iris.data array. Use three different colors to label each point with a color representing its species. Correctly label the x and y axes and include a legend for species.

1 Answer

3 votes

Answer:

from sklearn.datasets import load_iris

import seaborn as sns

import pandas as pd

data = load_iris()

final_data = data.data[:]

final_data = pd.DataFrame(final_data)

final_data.columns = ['SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm', 'PetalWidthCm']

species = data.target[:]

final_data['Species'] = species

sns.pairplot(final_data, hue='Species')

Step-by-step explanation:

User Allthenutsandbolts
by
5.1k points