-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path88.py
More file actions
42 lines (36 loc) · 1.1 KB
/
88.py
File metadata and controls
42 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Importing libraries
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import warnings
# Ignore warnings
warnings.filterwarnings('ignore')
# Load dataset (Iris dataset is built into seaborn)
df = sns.load_dataset("iris")
# Basic EDA
print("First 5 rows:\n", df.head())
print("\nDataset shape:", df.shape)
print("\nData Types:\n", df.dtypes)
print("\nSummary Statistics:\n", df.describe())
print("\nMissing Values:\n", df.isnull().sum())
print("\nUnique values in each column:\n", df.nunique())
# Univariate Analysis
# Distribution of each numerical column
num_columns = df.select_dtypes(include=['float64', 'int64']).columns
for col in num_columns:
plt.figure(figsize=(6, 4))
sns.histplot(df[col], kde=True, color='skyblue')
plt.title(f"Distribution of {col}")
plt.xlabel(col)
plt.ylabel("Frequency")
plt.grid(True)
plt.show()
# Univariate analysis for categorical column
plt.figure(figsize=(6, 4))
sns.countplot(x='species', data=df, palette='Set2')
plt.title("Count of each species")
plt.xlabel("Species")
plt.ylabel("Count")
plt.grid(True)
plt.show()