-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEDA.py
More file actions
84 lines (52 loc) · 1.8 KB
/
Copy pathEDA.py
File metadata and controls
84 lines (52 loc) · 1.8 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
dataset = pd.read_csv("Exploratory_data_analysis.csv")
# shape of the data
# print(dataset.shape)
# print(dataset.shape[0])
# print(dataset.shape[1])
# how to describe data. describe is find min, max, mean, std, percentile of the dataset
# print(dataset.describe())
# how to display total values change the display setting
# print(pd.options.display.max_rows)
# print(pd.options.display.max_columns)
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
# print(dataset.describe())
# see the top and bottum of the dataset
# print(dataset.head(10))
# print(dataset.tail(10))
# find the datatypes of datasets
# print(dataset.info())
# print(dataset.dtypes)
# identify data unique
# print(dataset.nunique())
# how to identify value counts hint: you identify one column use below
# print(dataset.iloc[:,4].value_counts())
# how to identify value counts in plots hint: using seaborn
sns.countplot(x="State", data=dataset)
plt.show()
# how to identify value counts hint: you identify muliple columns use below
'''
for i in range(0, dataset.shape[1]):
print("________",dataset.columns[i],"__________")
print(dataset.iloc[:,i].value_counts())
print("__________________________________")
'''
# find null values
# print(dataset.isnull().sum())
# sns.heatmap(dataset.isnull(),cbar=True)
# plt.show()
# finding mean, mode and fill the null values
# print(dataset.mean())
# print(dataset.mode())
# fill single column null value
# dataset["R&D Spend"].fillna((dataset["R&D Spend"].mean()), inplace=True)
# print(dataset["R&D Spend"])
# fill all column null value
dataset.fillna(dataset.mean(), inplace=True)
# print(dataset.isnull().sum())
print(dataset)