forked from rishis123/Air-Quality-Northeast-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataCleaner.py
59 lines (41 loc) · 1.3 KB
/
DataCleaner.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
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
import pandas as pd
arr = [9, 23, 25, 33, 34, 36, 42, 44, 50]
arr1 = ['Carbon monoxide', 'Ozone', 'Sulfur dioxide', 'Nitrogen dioxide (NO2)']
for k in range(0,10):
df = pd.read_excel('extracted_data_200' + str(k) + '.xlsx')
df.head()
arr2 = []
arr3 = []
arr4 = []
for i in arr:
for j in arr1:
new_df = df[(df["State Code"] == i) & (df['Parameter Name'] == j)]
arr2.append(new_df["Arithmetic Mean"].mean())
arr3.append(j)
arr4.append(i)
data = pd.DataFrame({
'State Names': arr4,
'Gases': arr3,
'Mean Value': arr2
})
data.to_excel('extracted_data_200' + str(k) + '.xlsx')
print(k)
for k in range(10,23):
df = pd.read_excel('extracted_data_20' + str(k) + '.xlsx')
df.head()
arr2 = []
arr3 = []
arr4 = []
for i in arr:
for j in arr1:
new_df = df[(df["State Code"] == i) & (df['Parameter Name'] == j)]
arr2.append(new_df["Arithmetic Mean"].mean())
arr3.append(j)
arr4.append(i)
data = pd.DataFrame({
'State Names': arr4,
'Gases': arr3,
'Mean Value': arr2
})
data.to_excel('extracted_data_20' + str(k) + '.xlsx')
print(k)