-
Notifications
You must be signed in to change notification settings - Fork 0
/
EDA.py
32 lines (28 loc) · 1.16 KB
/
EDA.py
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
# import dataset
# Import libraries
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
import seaborn as sns
import matplotlib.pyplot as plt
housing = fetch_california_housing()
data = pd.DataFrame(housing.data, columns=housing.feature_names)
data['PRICE'] = housing.target
def EDA(dataset):
print("================= Exploratory Data Analysis =================")
print("\n5 rows dataset:", dataset.head())
print("=============================================================")
print("\nSum of total columns:", len(dataset.columns))
print("=============================================================")
print("\ndataset info:", dataset.info())
print("=============================================================")
print("\nDescribe of data:", dataset.describe())
print("=============================================================")
sns.heatmap(dataset.corr(), annot=True)
plt.show()
return dataset.head()
EDA(data)