1
0

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')