forked from bvn-architecture/shakedownCompetition
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataframeGen.py
More file actions
26 lines (21 loc) · 887 Bytes
/
dataframeGen.py
File metadata and controls
26 lines (21 loc) · 887 Bytes
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
# Imports
import json
import pandas as pd
import numpy as np
# Loading the JSON data from the file
with open("betterTransitionlessData.json", "r") as jsonFile:
jsonList = json.load(jsonFile)
tempArrays = [entry["temps"] for entry in jsonList]
states = [entry["state"] for entry in jsonList]
names = [entry["name"] for entry in jsonList]
times = [entry["time"] for entry in jsonList]
cubicleData_allInfo = pd.DataFrame(data={"State": states, "TemperatureArray": tempArrays, "ID": names, "Time": times})
#print(cubicleData)
cubicleData_essentialInfo_structured = pd.DataFrame(data={"State": states, "TemperatureArray": tempArrays})
flatLists = []
for index in range(len(tempArrays)):
arrayList = [states[index]]
for subList in tempArrays[index]:
arrayList.extend(subList)
flatLists.append(arrayList)
cubicleData_essentialInfo_flat = pd.DataFrame(flatLists)