Group A

Q10: Data Visualization III Download the Iris flower dataset or any other dataset into a DataFrame. (e.g., https://archive.ics.uci.edu/ml/datasets/Iris). Scan the dataset and give the inference as: 1. List down the features and their types (e.g., numeric, nominal) available in the dataset. 2. Create a histogram for each feature in the dataset to illustrate the feature distributions. 3. Create a boxplot for each feature in the dataset. 4. Compare distributions and identify outliers.

Data Visualization III

Solution and implementation for Q10 from Data Science Laboratory (ds).

10_data_visualization_3.py Download
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# load dataset
df = sns.load_dataset("iris")

print("Dataset:\n", df.head())

# features cand types
print("\nFeatures and Data Types:\n")
print(df.dtypes)

# histograms
df.hist(figsize=(8,6))
plt.suptitle("Histograms")
plt.show()

# boxplots
for col in df.columns[:-1]:
    sns.boxplot(y=df[col])
    plt.title(col)
    plt.show()

Other Questions in Data Science Laboratory

See All Available Questions
Download