-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent.py
More file actions
39 lines (25 loc) · 667 Bytes
/
Copy pathstudent.py
File metadata and controls
39 lines (25 loc) · 667 Bytes
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
# Data-Collection-Data-Source-Identification
import pandas as pd
# Load dataset
df = pd.read_csv('Titanic-Dataset.csv')
# First 5 rows
print(df.head())
# Shape
print(df.shape)
# Data types
print(df.dtypes)
# Dataset info
print(df.info())
# Statistical summary
print(df.describe())
# Missing values
print(df.isnull().sum())
# Numerical columns
print(df.select_dtypes(include=['int64', 'float64']).columns)
# Categorical columns
print(df.select_dtypes(include=['object']).columns)
# Unique values
categorical_cols = df.select_dtypes(include=['object']).columns
for col in categorical_cols:
print(f"\nColumn: {col}")
print(df[col].unique()[:10])