瀏覽代碼

Merge branch 'dev' of http://git.fast-fun.cn:92/lmstack/data_analyze_platform into dev

qingfeng 2 年之前
父節點
當前提交
c4402e223f

二進制
LIB/MIDDLE/InfoChrgDrive/Charge/kmeans1.pkl


二進制
LIB/MIDDLE/InfoChrgDrive/Charge/kmeans2.pkl


二進制
LIB/MIDDLE/InfoChrgDrive/Charge/kmeans3.pkl


+ 8 - 1
LIB/MIDDLE/InfoChrgDrive/Charge/main_V0.py

@@ -72,7 +72,14 @@ def diag_cal():
                     df_diag_ram_sn=df_diag_ram[df_diag_ram['sn']==sn]
                     if not df_diag_ram_sn.empty:   #该sn相关结果非空
                         df_diag_ram_sn.reset_index(inplace=True,drop=True)
+<<<<<<< HEAD
                         df_diag_ram_sn=df_diag_ram_sn.iloc[-1]
+=======
+                        df_diag_ram_sn['time_end']=list(map(lambda x: datetime.datetime.strptime(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=df_diag_ram_sn.iloc[-1]
+                        time_end =df_diag_ram_sn['time_end']
+>>>>>>> f5e9b82c209c00251722abc6e4c4e8e94e7c130f
                         df_diag_ram_sn.reset_index(inplace=True,drop=True)
                 df_diag_new,df_diag_change=pro_output(df_merge,sn,gpscity,df_diag_ram_sn)
                 kmeans1 = joblib.load('kmeans1.pkl')
@@ -81,7 +88,7 @@ def diag_cal():
                 df_diag_new=prediction(df_diag_new,kmeans1,kmeans2,kmeans3)
                 df_diag_change=prediction(df_diag_change,kmeans1,kmeans2,kmeans3)
                 if not df_diag_change.empty:   #需变更的结果非空
-                    cursor.execute("DELETE FROM algo_charge_info WHERE time_end = '0000-00-00 00:00:00' and sn='{}'".format(sn))
+                    cursor.execute("DELETE FROM algo_charge_info WHERE time_end = '{}' and sn='{}'".format(time_end,sn))
                     mysql.commit()
                     df_diag_change.to_sql("algo_charge_info",con=db_res_engine, if_exists="append",index=False)