dataprep routine fusing two dataframes
This commit is contained in:
@@ -772,7 +772,27 @@ def smalldataprep(therows,xparam,yparam1,yparam2):
|
||||
pass
|
||||
|
||||
return df
|
||||
|
||||
|
||||
# data fusion
|
||||
def datafusion(id1,id2,column,offset):
|
||||
df1 = getrowdata_db(id=id1)
|
||||
columns = ['time',column]
|
||||
df2 = getsmallrowdata_db(columns,ids=[id2])
|
||||
|
||||
keep1 = set(df1.columns)
|
||||
keep1.pop(column)
|
||||
|
||||
for c in df1.columns:
|
||||
if not c in keep1:
|
||||
df1 = df1.drop(c,1,errors='ignore')
|
||||
|
||||
df = pd.concat([df1,df2],ignore_index=True)
|
||||
df = df.sort_value(['time'])
|
||||
df.interpolate(method='linear',axis=0,limit_direction='both')
|
||||
df.fillna(method='bfill',inplace=True)
|
||||
|
||||
return df
|
||||
|
||||
# This is the main routine.
|
||||
# it reindexes, sorts, filters, and smooths the data, then
|
||||
# saves it to the stroke_data table in the database
|
||||
|
||||
Reference in New Issue
Block a user