forked from johnashu/datacamp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcleaning_data.py
More file actions
61 lines (36 loc) · 1.17 KB
/
cleaning_data.py
File metadata and controls
61 lines (36 loc) · 1.17 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
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('dob_job_application_filings_subset.csv')
df_subset = pd.read_csv('dob_job_application_filings_subset.csv')
# anaylise
print(df.head())
print(df.tail())
print(df.shape)
print(df.columns)
print(df_subset.head())
print(df_subset.tail())
# analzye using .info()
print(df.info())
df1 = df.State.value_counts(dropna=False).head()
print(df1)
df2 = df.Paid.value_counts(dropna=False).head()
print(df2)
print(df['Borough'].value_counts(dropna=False))
print(df['State'].value_counts(dropna=False))
print(df['Site Fill'].value_counts(dropna=False))
# Data Visualisation
df['Existing Zoning Sqft'].plot(kind='hist', rot=70, logx=True, logy=True)
plt.show()
# boxplots
df.plot(kind='scatter', x='Proposed Height', y='Existing Zoning Sqft', rot=70)
plt.show()
df.boxplot(column='Proposed Height', by='Existing Zoning Sqft', rot=90)
plt.show()
# Import necessary modules
import pandas as pd
import matplotlib.pyplot as plt
df.plot(kind='scatter', x='initial_cost', y='total_est_fee', rot=70)
plt.show()
df_subset.plot(kind='scatter', x='initial_cost', y='total_est_fee', rot=70)
plt.show()
# Reshape Data Using Melt