First time here? Check out the Help page!
1 | initial version |
Re Julien's rant above, regarding the poor E+ time conventions. Here is a snippet of python code that might be useful:
def read_eplusout(datafile, year=2018):
ep_datas={}
if os.path.exists(datafile):
with open(datafile,mode='r') as inf:
hline=inf.readline() ##Reads the line of headers
for hhead in hline.split(','):
hhead=hhead.rstrip()
##Make sure that we read a variable that we want
ep_datas[hhead]=[]
##Creates a huge data structure
for i, lline in enumerate(inf):
for hhead,dd in zip(hline.split(','),lline.split(',')):
hhead=hhead.rstrip()
if hhead=='Date/Time':
tyy,thh=dd.split()
mm,dd=tyy.split('/')
hh,mmm,ss=thh.split(':')
if hh=='24':
ddt=ep_datas[hhead][-1]+(ep_datas[hhead][-1]-ep_datas[hhead][-2])
else:
ddt=datetime.datetime(year,int(mm),int(dd),int(hh),int(mmm),int(ss))
ep_datas[hhead].append(ddt)
continue
if dd=="":
dd=0.0
ep_datas[hhead].append(float(dd))
data_frame = pd.DataFrame(ep_datas)
data_frame = data_frame.set_index(pd.DatetimeIndex(ep_datas['Date/Time']))
return data_frame