dataset.py 887 B

123456789101112131415161718192021222324252627282930
  1. from LIB.BACKEND import DBManager
  2. from LIB.MIDDLE.CellStateEstimation.Common import log
  3. import datetime
  4. import pandas as pd
  5. dbManager = DBManager.DBManager()
  6. #log信息配置
  7. mylog=log.Mylog('log.txt','error')
  8. mylog.logcfg()
  9. dataSOH = pd.read_excel('sn-20210903.xlsx',sheet_name='MGMC')
  10. fileNames = dataSOH['sn']
  11. fileNames = list(fileNames)
  12. data_GMGC=pd.DataFrame()
  13. for k in range(len(fileNames)):
  14. try:
  15. sn = fileNames[k]
  16. df_data = dbManager.get_data(sn=sn, start_time='2021-07-01 00:00:00', end_time='2021-11-01 00:00:00', data_groups=['bms','gps'])
  17. data_bms = df_data['bms']
  18. data_gps = df_data['gps']
  19. df_merge=pd.merge(data_bms, data_gps,how='outer',sort=True)
  20. df_merge['sn']=sn
  21. data_GMGC=data_GMGC.append(df_merge)
  22. except Exception as e:
  23. print(repr(e))
  24. mylog.logopt(sn,e)
  25. pass