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