Private
Public Access
1
0

dataprep routine fusing two dataframes

This commit is contained in:
Sander Roosendaal
2017-02-24 15:57:20 +01:00
parent 6f02e86e63
commit 97189ef02b
2 changed files with 22 additions and 2 deletions

View File

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