w3resource

Python Scikit-learn: Create a pairplot of the iris data set and check which flower species seems to be the most separable

Python Machine learning Iris Visualization: Exercise-13 with Solution

Write a Python program to create a pairplot of the iris data set and check which flower species seems to be the most separable.

Sample Solution:

Python Code:

# Import necessary modules
import pandas as pd
import seaborn as sns
iris = pd.read_csv("iris.csv")
#Drop id column
iris = iris.drop('Id',axis=1)
sns.pairplot(iris,hue='Species')

Sample Output:

Python Machine learning Output: Iris Visualization: Exercise-13
 

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to create a joinplot using “kde” to describe individual distributions on the same plot between Sepal length and Sepal width and use ‘+’ sign as marker.

Next: Write a Python program to find the correlation between variables of iris data. Also create a hitmap using Seaborn to present their relations.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.