In [1]:
import seaborn as sns #Import sns for data visualization
import pandas as pd #import pandas for data manipulation
import matplotlib.pyplot as plt #import matplotlib for data visualization
# Load the Iris dataset from seaborn
iris = sns.load_dataset('iris')
# Display the first few rows
print(iris.head())
sepal_length sepal_width petal_length petal_width species
0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa
In [2]:
# Print data types of all columns
print(iris.dtypes)
sepal_length float64
sepal_width float64
petal_length float64
petal_width float64
species object
dtype: object
In [3]:
# Set up the plot grid
iris.hist(bins=20, figsize=(12, 8), edgecolor='black')
plt.suptitle('Histograms of Iris Features', fontsize=16)
plt.tight_layout()
plt.show()
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
In [5]:
# Create individual box plots for each numeric feature
plt.figure(figsize=(12, 6))
sns.boxplot(data=iris)
plt.title('Boxplots of Iris Features')
plt.xlabel('Features')
plt.ylabel('Values')
plt.grid(True)
plt.show()
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
In [ ]:
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF