This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
def fis_data_to_dataframe(fis_data): | |
""" Creates a DataFrame from list of FIS responses | |
""" | |
COLUMNS = ['channel', 'date', 'min', 'max', 'mean', 'stDev'] | |
data = [] | |
for fis_response in fis_data: | |
for channel, channel_stats in fis_response.items(): | |
for stat in channel_stats: | |
row = [int(channel[1:]), parse_time(stat['date'], force_datetime=True)] | |
for column in COLUMNS[2:]: | |
row.append(stat['basicStats'][column]) | |
data.append(row) | |
return pd.DataFrame(data, columns=COLUMNS).sort_values(['channel', 'date']) | |
df = fis_data_to_dataframe(fis_data) | |
df.head() |
