import CBMSBatInterShort import log #coding=utf-8 import datetime import pandas as pd from LIB.BACKEND import DBManager from sqlalchemy import create_engine import datetime import os dbManager = DBManager.DBManager() if __name__ == "__main__": filepath=r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\98Download' files=os.listdir(filepath) # now_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') # now_time=datetime.datetime.strptime(now_time,'%Y-%m-%d %H:%M:%S') # start_time=now_time-datetime.timedelta(days=30) # end_time=str(now_time) # start_time=str(start_time) #log信息配置 mylog=log.Mylog('log.txt','error') mylog.logcfg() for filename in files: try: # filename=files[7] sn=filename[7:-5] print(sn) celltype=100 df_volt = pd.read_excel(filepath+'\\'+filename,sheet_name='单体电池电压数据') df_temp = pd.read_excel(filepath+'\\'+filename,sheet_name='单体电池温度数据') df_bms = pd.read_excel(filepath+'\\'+filename,sheet_name='整车数据') df_volt.columns=df_volt.loc[0].astype('str') df_temp.columns=df_temp.loc[0].astype('str') df_volt=df_volt.drop(0,axis=0) df_temp=df_temp.drop(0,axis=0) df_volt=df_volt.reset_index(drop=True) df_temp=df_temp.reset_index(drop=True) df_accum=pd.DataFrame() # df_volt.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_v_'+sn+'.xlsx') # df_temp.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_t_'+sn+'.xlsx') # print(df_volt['1.0']) BatInterShort=CBMSBatInterShort.BatInterShort(sn,celltype,df_bms,df_volt,df_temp,df_accum) df_res=BatInterShort.intershort() df_res.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_InterShort_'+sn+'.xlsx') print(sn,'done!!!') except IndexError as e: print(repr(e)) mylog.logopt(sn,e) pass