[go: up one dir, main page]

0% found this document useful (0 votes)
11 views3 pages

DSBDA Assignment 10

The document demonstrates how to load and visualize the Iris dataset using Python libraries such as Seaborn, Pandas, and Matplotlib. It includes steps to display the first few rows of the dataset, print data types of columns, and create histograms and box plots for data visualization. The visualizations help in understanding the distribution and characteristics of the Iris features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

DSBDA Assignment 10

The document demonstrates how to load and visualize the Iris dataset using Python libraries such as Seaborn, Pandas, and Matplotlib. It includes steps to display the first few rows of the dataset, print data types of columns, and create histograms and box plots for data visualization. The visualizations help in understanding the distribution and characteristics of the Iris features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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

You might also like