Python Scikit-learn: Create a hitmap using Seaborn to present their relations
Python Machine learning Iris Visualization: Exercise-17 with Solution
Write a Python program to find the correlation between variables of iris data. Also create a hitmap using Seaborn to present their relations.
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns iris = pd.read_csv("iris.csv") #Drop id column iris = iris.drop('Id',axis=1) X = iris.iloc[:, 0:4] f, ax = plt.subplots(figsize=(10, 8)) corr = X.corr() print(corr) sns.heatmap(corr, mask=np.zeros_like(corr, dtype=np.bool), cmap=sns.diverging_palette(220, 10, as_cmap=True),square=True, ax=ax, linewidths=.5) plt.show()
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.Write a Python program to create a box plot (or box-and-whisker plot) which shows the distribution of quantitative data in a way that facilitates comparisons between variables or across levels of a categorical variable of iris dataset. Use seaborn.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework