Last active
August 29, 2015 14:21
-
-
Save eayoungs/0b6e0db5f28e1848582e to your computer and use it in GitHub Desktop.
Eppy readhtml script
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
from eppy import modeleditor | |
from eppy.modeleditor import IDF | |
from eppy import readhtml | |
import pandas as pd | |
import matplotlib | |
import numpy as np | |
import pprint | |
import glob, os | |
try: | |
IDF.setiddname('/Applications/EnergyPlus-8-1-0/Energy+.idd') | |
except modeleditor.IDDAlreadySetError as e: | |
pass | |
simFiles = [] | |
os.chdir(".") | |
for file in glob.glob("*.htm"): | |
simFiles.append(file) | |
allTables = {} | |
fileTables = {} | |
#for simFile in simFiles: | |
filehandle = open(simFiles[0],'r').read() | |
htables=readhtml.titletable(filehandle) | |
alltitles = [htable[0] for htable in htables] | |
ltables = readhtml.lines_table(filehandle) # reads the tables with their titles | |
allTables = dict(zip(alltitles, ltables)) | |
# for simFile in simFiles: | |
atable=allTables['End Uses'][1] | |
rows = atable[1:15] | |
data = [row[1:] for row in rows] | |
colNames = atable[0][1:] | |
rowNames = [row[0] for row in rows] | |
df=pd.DataFrame(data, columns=colNames, index=rowNames) | |
# matplotlib.style.use('ggplot') | |
# %matplotlib inline | |
df.plot(kind='barh', stacked='true') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment