Menu

Exploratory Data Analysis on Iris Data

Exploratory Data Analysis on Iris Data

Once the dataset is loaded, the next step is exploring it, so you understand the patterns and relationships hidden inside the data before building any model.

Checking Basic Information

print(df.info())
print(df.describe())

df.info() shows the data types and confirms there are no missing values. df.describe() shows statistics like mean, minimum, and maximum for each feature.

Visualizing Feature Relationships

import seaborn as sns
import matplotlib.pyplot as plt

sns.pairplot(df, hue="species")
plt.show()

Code Explanation

  • sns.pairplot() plots every feature against every other feature, giving a full visual picture of the data.
  • hue="species" colors the points based on species, making it easy to see how well the species separate visually.
  • plt.show() renders the plots on screen.

Note:

  • After running this code, you should notice that petal length and petal width separate the three species more clearly than sepal measurements do.
  • This insight becomes useful later, once the model starts making predictions, since it confirms which features matter most.

Machine Learning Tutorial

AP

Abhishek Pati



Learn via Video Course

Artificial Intelligence and Machine Learning Course Logo

Artificial Intelligence and Machine Learning Course

55 hrs



Get in Touch For Details