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

Task 01

The document outlines a task involving the exploration and visualization of the Iris dataset using Python libraries such as pandas, matplotlib, and seaborn. It includes steps for importing libraries, loading the dataset, inspecting its structure, and creating key visualizations like scatter plots, histograms, and box plots. The task aims to help users understand data relationships, distributions, and variations within the dataset.
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)
8 views3 pages

Task 01

The document outlines a task involving the exploration and visualization of the Iris dataset using Python libraries such as pandas, matplotlib, and seaborn. It includes steps for importing libraries, loading the dataset, inspecting its structure, and creating key visualizations like scatter plots, histograms, and box plots. The task aims to help users understand data relationships, distributions, and variations within the dataset.
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

Task 1: Exploring and Visualizing the Iris Dataset using Python, pandas, matplotlib, and seaborn.

1. Import Required Libraries

import pandas as pd
import seaborn as sns
import [Link] as plt

2. Load the Iris Dataset

# Load directly from the seaborn


df = sns.load_dataset('iris')

3. Inspect the Dataset

# Display the shape of the dataset


print("Shape:", [Link])

# Display the column names


print("Columns:", [Link]())

# Show the first 5 rows


print([Link]())

Shape: (150, 5)
Columns: ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species']
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

4. Scatter Plot

[Link](data=df, x='sepal_length', y='sepal_width', hue='species')


[Link]('Sepal Length vs Sepal Width')
[Link]()

spark What can I help you build? add_circle send


5. Histogram
df['petal_length'].hist(bins=20, edgecolor='black')
[Link]('Distribution of Petal Length')
[Link]('Petal Length')
[Link]('Frequency')
[Link]()

I can also use seaborn for prettier output:

[Link](df['petal_length'], kde=True)
[Link]('Petal Length Distribution')
[Link]()

6. Box Plot

[Link](data=df, x='species', y='sepal_length')


[Link]('Sepal Length by Species')
[Link]()
Summary With this task, you will have:

Loaded and inspected a real dataset.

Created key visualizations:

Scatter plot to study relationships.

Histogram to see distributions.

Box plot to detect outliers and variation.

You might also like