0% found this document useful (0 votes)
5 views5 pages

Data Analytics Experiments with Python

The document outlines five simple experiments for data analytics and visualization using the Iris dataset. Each experiment includes objectives, steps, and expected outputs, covering tasks such as exploring datasets, creating basic plots, calculating correlations, filtering and grouping data, and generating interactive plots with Plotly. It encourages students to experiment with small datasets and utilize Google Colab for execution.

Uploaded by

Rachana Kurade
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Data Analytics Experiments with Python

The document outlines five simple experiments for data analytics and visualization using the Iris dataset. Each experiment includes objectives, steps, and expected outputs, covering tasks such as exploring datasets, creating basic plots, calculating correlations, filtering and grouping data, and generating interactive plots with Plotly. It encourages students to experiment with small datasets and utilize Google Colab for execution.

Uploaded by

Rachana Kurade
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Data Analytics & Visualization Lab – 5 Simple Experiments

Experiment 1: Exploring a Dataset

Objective: Learn how to read and understand a dataset.

Steps:

1. Load a dataset (Iris dataset).

2. View the first 5 rows.

3. Check column names, data types, and basic statistics.

4. Check for missing values.

Code:

import pandas as pd

# Load dataset

data = pd.read_csv("[Link]
[Link]")

# Display first 5 rows

print([Link]())

# Column names and data types

print([Link])

print([Link]())

# Basic statistics

print([Link]())
# Check missing values

print([Link]().sum())

Expected Output:

 First 5 rows of dataset

 Column names: ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species']

 Data types (float64 for numeric, object for categorical)

 Basic statistics: mean, min, max, std

 Missing values: all 0

Experiment 2: Basic Plots

Objective: Create simple visualizations to understand data distribution.

Steps:

1. Plot a histogram of sepal_length.

2. Scatter plot of sepal_length vs petal_length.

3. Bar plot of species counts.

Code:

import [Link] as plt

import seaborn as sns

# Histogram

data['sepal_length'].hist()

[Link]("Histogram of Sepal Length")

[Link]()

# Scatter plot

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


[Link]("Sepal Length vs Petal Length")

[Link]()

# Bar plot

data['species'].value_counts().plot(kind='bar')

[Link]("Count of Each Species")

[Link]()

Expected Output:

 Histogram showing frequency of sepal lengths

 Scatter plot showing relationship between sepal and petal length

 Bar chart showing counts of setosa, versicolor, virginica

Experiment 3: Correlation and Heatmap

Objective: Find relationships between numerical columns.

Steps:

1. Calculate correlation.

2. Visualize correlation using a heatmap.

Code:

# Correlation

corr = [Link]()

print(corr)

# Heatmap

[Link](corr, annot=True, cmap='coolwarm')

[Link]("Correlation Heatmap")

[Link]()
Expected Output:

 Correlation matrix showing values between -1 to 1

 Heatmap with colors: strong positive correlation between petal_length and petal_width

Experiment 4: Filtering and Grouping Data

Objective: Learn to filter rows and summarize data.

Steps:

1. Filter rows with sepal_length > 5.0.

2. Group data by species and calculate mean petal_length.

Code:

# Filter

filtered = data[data['sepal_length'] > 5.0]

print([Link]())

# Group by species

grouped = [Link]('species')['petal_length'].mean()

print(grouped)

Expected Output:

 Filtered rows where sepal_length > 5.0

 Mean petal length for each species:

 species

 setosa 1.464

 versicolor 4.26

 virginica 5.55

Experiment 5: Interactive Plot with Plotly


Objective: Create an interactive plot for better visualization.

Steps:

1. Scatter plot of sepal_length vs petal_length colored by species.

2. Enable interactive hover and zoom.

Code:

import [Link] as px

fig = [Link](data, x='sepal_length', y='petal_length', color='species', size='petal_width',

title="Interactive Scatter Plot: Sepal vs Petal Length")

[Link]()

Expected Output:

 Interactive scatter plot

 Different colors for species

 Hovering shows exact values of each point

 Zoom and pan functionality

✅ Notes for Students

 Use small datasets first (like Iris).

 Experiment by changing columns, colors, and plot types.

 You can run all these codes directly on Google Colab.

You might also like