|
| 1 | +import seaborn as sns |
| 2 | +import pandas as pd |
| 3 | +import matplotlib.pyplot as plt |
| 4 | + |
| 5 | +# Load the Iris dataset from Seaborn |
| 6 | +iris = sns.load_dataset("iris") |
| 7 | +numeric_iris = iris.drop(columns='species') |
| 8 | + |
| 9 | +# Display the first few rows of the dataset |
| 10 | +print("First few rows of the dataset:") |
| 11 | +print(iris.head()) |
| 12 | + |
| 13 | +# Summary statistics |
| 14 | +print("\nSummary statistics:") |
| 15 | +print(iris.describe()) |
| 16 | + |
| 17 | +# Checking for missing values |
| 18 | +print("\nMissing values:") |
| 19 | +print(iris.isnull().sum()) |
| 20 | + |
| 21 | +# Visualizations |
| 22 | +# Pairplot |
| 23 | +sns.pairplot(iris, hue="species") |
| 24 | +plt.title("Pairplot of Iris Dataset") |
| 25 | +plt.show() |
| 26 | + |
| 27 | +# Boxplot |
| 28 | +plt.figure(figsize=(10, 6)) |
| 29 | +sns.boxplot(data=iris, orient="h") |
| 30 | +plt.title("Boxplot of Iris Dataset") |
| 31 | +plt.show() |
| 32 | + |
| 33 | +# Histograms |
| 34 | +plt.figure(figsize=(10, 6)) |
| 35 | +iris.hist() |
| 36 | +plt.suptitle("Histograms of Iris Dataset") |
| 37 | +plt.show() |
| 38 | + |
| 39 | +# Correlation heatmap |
| 40 | +plt.figure(figsize=(8, 6)) |
| 41 | +sns.heatmap(numeric_iris.corr(), annot=True, cmap="coolwarm") |
| 42 | +plt.title("Correlation Heatmap of Iris Dataset") |
| 43 | +plt.show() |
0 commit comments