2 커밋 4542b61ec2 ... 59aa378daa

작성자 SHA1 메시지 날짜
  zhuxi 59aa378daa Merge branch 'dev' of http://git.fast-fun.cn:92/lmstack/data_analyze_platform into dev 2 년 전
  zhuxi 0581daf070 debug 2 년 전
2개의 변경된 파일10개의 추가작업 그리고 10개의 파일을 삭제
  1. 1 7
      LIB/MIDDLE/InfoChrgDrive/Charge/V1_0_0/coreV0.py
  2. 9 3
      LIB/MIDDLE/InfoChrgDrive/Charge/main_V0.py

+ 1 - 7
LIB/MIDDLE/InfoChrgDrive/Charge/V1_0_0/coreV0.py

@@ -423,13 +423,7 @@ def mkdf_chrg(chrg,data_new,param):
         df_sts_chrg=df_sts_chrg.append(df_sts_chrg_temp)
     return df_sts_chrg
 
-def pro_output(df_merge,sn,gpscity,df_diag_ram_sn):
-    chrg_last=pd.Series()
-    if len(df_diag_ram_sn)>0:
-        df_diag_ram_sn['time_end']=list(map(lambda x: datetime.datetime.strptime(str(x),'%Y-%m-%d %H:%M:%S'),list(df_diag_ram_sn['time_end'])))
-        df_diag_ram_sn = df_diag_ram_sn.sort_values(by = 'time_end')
-        df_diag_ram_sn.reset_index(inplace=True,drop=True)
-        chrg_last=df_diag_ram_sn.iloc[-1]
+def pro_output(df_merge,sn,gpscity,chrg_last):
     new=pd.DataFrame()
     change=pd.DataFrame()
     if len(df_merge)>0:

+ 9 - 3
LIB/MIDDLE/InfoChrgDrive/Charge/main_V0.py

@@ -67,11 +67,17 @@ def diag_cal():
             if not df_bms.empty:   #BMS数据非空
                 df_merge=pd.merge(df_bms,df_gps,how='outer',sort=True)
                 df_merge['sn']=sn
-                df_diag_ram_sn=pd.DataFrame()
+                chrg_last=pd.Series()
                 if not df_diag_ram.empty:   #结果库非空
                     df_diag_ram_sn=df_diag_ram[df_diag_ram['sn']==sn]
-
-                df_diag_new,df_diag_change=pro_output(df_merge,sn,gpscity,df_diag_ram_sn)
+                    if not df_diag_ram_sn.empty: 
+                        df_diag_ram_sn['time_end']=list(map(lambda x: datetime.datetime.strptime(str(x),'%Y-%m-%d %H:%M:%S'),list(df_diag_ram_sn['time_end'])))
+                        df_diag_ram_sn = df_diag_ram_sn.sort_values(by = 'time_end')
+                        df_diag_ram_sn.reset_index(inplace=True,drop=True)
+                        chrg_last=df_diag_ram_sn.iloc[-1]
+                        time_end=chrg_last['time_end']
+
+                df_diag_new,df_diag_change=pro_output(df_merge,sn,gpscity,chrg_last)
                 kmeans1 = joblib.load('kmeans1.pkl')
                 kmeans2 = joblib.load('kmeans2.pkl')
                 kmeans3 = joblib.load('kmeans3.pkl')