Write a python program that uses the Pandas library to analyze a dataset, calculate summary statistics, and visualize the results using Matplotlib.
PLAINFORMAT
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load the Iris dataset
iris = sns.load_dataset("iris")

# Display the first 5 rows of the dataset
print(iris.head())

# Calculate summary statistics for the dataset
summary_statistics = iris.describe()
print("\nSummary Statistics:\n", summary_statistics)

# Visualize the distribution of features using histograms
iris.hist(edgecolor="black", linewidth=1.2)
plt.show()

# Create a pairplot to visualize relationships between features
sns.pairplot(iris, hue="species")
plt.show()

# Create a box plot to visualize the distribution of each feature by species
iris.boxplot(by="species", figsize=(12, 6))
plt.show()

# Calculate the correlation matrix
correlation_matrix = iris.corr()
print("\nCorrelation Matrix:\n", correlation_matrix)

# Visualize the correlation matrix using a heatmap
sns.heatmap(correlation_matrix, annot=True, cmap="coolwarm")
plt.show()