Python Scikit-learn: Create a graph to see how the length and width of SepalLength, SepalWidth, PetalLength, PetalWidth are distributed
Python Machine learning Iris Visualization: Exercise-6 with Solution
Write a Python program to create a graph to see how the length and width of SepalLength, SepalWidth, PetalLength, PetalWidth are distributed.
Sample Solution:
Python Code:
import pandas as pd
import matplotlib.pyplot as plt
iris = pd.read_csv("iris.csv")
# Drop id column
new_data = iris.drop('Id',axis=1)
new_data.hist(edgecolor='black', linewidth=1.2)
fig=plt.gcf()
fig.set_size_inches(12,12)
plt.show()
Sample Output:
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 graph to find relationship between the petal length and width.
Next: Write a Python program to create a joinplot to describe individual distributions on the same plot between Sepal length and Sepal width.
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/machine-learning/scikit-learn/iris/python-machine-learning-scikit-learn-iris-visualization-exercise-6.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics