Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Analyzing Data with Pandas and Visualizing Results with Matplotlib

Objective

The purpose of this project is to demonstrate basic data analysis and visualization skills using Python's pandas, matplotlib, and seaborn libraries. The analysis uses the classic Iris dataset, a popular dataset for classification and pattern recognition tasks in data science and machine learning.


Project Structure


├── iris\_analysis.ipynb      # Jupyter notebook with code, visualizations, and insights
├── iris\_analysis.py         # Python script version of the analysis
├── README.md                # Project documentation


Tools & Libraries Used

  • Python 3.x
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn (for loading the Iris dataset)

Dataset: Iris Flower Dataset

  • Source: Scikit-learn’s built-in datasets
  • Features:
    • Sepal Length (cm)
    • Sepal Width (cm)
    • Petal Length (cm)
    • Petal Width (cm)
  • Target: Iris Species (Setosa, Versicolor, Virginica)

Tasks Completed

Task 1: Load and Explore the Dataset

  • Loaded the Iris dataset using sklearn.datasets.load_iris().
  • Converted it into a pandas DataFrame.
  • Inspected data using .head() and .info().
  • Checked for missing values.
  • Verified data types.

Task 2: Basic Data Analysis

  • Used .describe() to compute statistics like mean, median, and standard deviation.
  • Performed groupings by species and calculated the mean of features.
  • Identified notable trends and differences between species.

Task 3: Data Visualization

Created the following plots:

  1. Line Chart – Showing petal length trends across samples.
  2. Bar Chart – Comparing average sepal width for each Iris species.
  3. Histogram – Displaying distribution of petal length.
  4. Scatter Plot – Visualizing relationship between sepal length and petal length.

All plots were customized with titles, axis labels, legends, and gridlines.


Observations & Insights

  • Setosa species has significantly smaller petal lengths and widths compared to the other two.
  • There is a strong positive correlation between petal length and sepal length.
  • Versicolor and Virginica have more overlap in feature values, which makes them harder to separate visually.

Error Handling

  • Added try-except block to handle dataset loading errors gracefully.
  • Ensured that missing data (if any) is handled by checking with .isnull().sum().

How to Run

  1. Python Script:
    python iris_analysis.py

2. **Jupyter Notebook**:
   Open `iris_analysis.ipynb` in Jupyter Notebook or VS Code and run all cells.

---

##  Author

This project was completed as part of a Python assignment focusing on data analysis and visualization techniques.

---

##  Contact

For questions or feedback, feel free to reach out.

About

Python for data analysis

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages