-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_data.py
More file actions
42 lines (33 loc) · 1.54 KB
/
parse_data.py
File metadata and controls
42 lines (33 loc) · 1.54 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
import pandas as pd
import os
PATH = "C:\\Users\\Andrew\\Documents\MASc\\LoadCoincidence\\load_data\\"
# take only total kw from each commercial load and combine to one file
commercial_list = os.listdir(PATH+"commercial")
df = pd.read_parquet(PATH+"commercial\\"+commercial_list[0])
df = df[['Time', 'total_site_electricity_kw']]
df = df.set_index('Time')
identifier=commercial_list[0].split(".")[0]
df = df.rename(columns={'total_site_electricity_kw': identifier})
for file in commercial_list[1:]:
other = pd.read_parquet(PATH+"commercial\\"+file)
other = other[['Time', 'total_site_electricity_kw']]
other=other.set_index('Time')
identifier=file.split(".")[0]
other = other.rename(columns={'total_site_electricity_kw': identifier})
df=df.join(other, how='inner')
df.to_parquet(PATH+"commercial_loads.parquet")
# take only total kw from each residential load and combine to one file
residential_list = os.listdir(PATH+"residential")
df = pd.read_parquet(PATH+"residential\\"+residential_list[0])
df = df[['Time', 'total_site_electricity_kw']]
df = df.set_index('Time')
identifier=residential_list[0].split(".")[0]
df = df.rename(columns={'total_site_electricity_kw': identifier})
for file in residential_list[1:]:
other = pd.read_parquet(PATH+"residential\\"+file)
other = other[['Time', 'total_site_electricity_kw']]
other=other.set_index('Time')
identifier=file.split(".")[0]
other = other.rename(columns={'total_site_electricity_kw': identifier})
df=df.join(other, how='inner')
df.to_parquet(PATH+"residential_loads.parquet")