Pandas/Python: How to match rows of 2 dataframes together based on close but not equal values? -


i'm new python , pandas , use on one..

background- i'm trying extract unsynchronised dual-doppler measurements scanning lidar taking ppi scans. have data (from mysql) loaded pandas dataframes, , need apply matching function rows matched if time of measurement within limit (time < 8s apart).

here example of contained in dataframes: https://gist.github.com/anonymous/b0cc61b461c9e2d8f7bf

column dt_stop (from labview) measured in seconds , want match based on.
in example, row 0 of df1 have no match since there 20 seconds between , row contained within df2.
row 1 of df1 match row 0 of df2 since there 0.5 seconds apart.
matches concatenated horizontally can perform calculations along same row.

i hope makes sense. appreciated!

here current code: https://gist.github.com/anonymous/6dee303f4f8260600fdd

i took mr. f's advice , solved inside query.

here did future reference.. hope helps someone!

select wk.gw_id, wk.scn_id, wk.dt_start, wk.dt_stop, wk.azim, wkdat.radspeed, wkdat.cnr, wkdat.disp, wst.gw_id, wst.scn_id, wst.dt_start, wst.dt_stop, wst.azim, wstdat.radspeed, wstdat.cnr, wstdat.disp   wisscas.wind_def_koshava wk inner join wisscas.wind_def_sterenn wst on (abs(wk.dt_stop-wst.dt_stop)<2.0 , abs(wk.dt_start-wst.dt_start)<2.0) inner join wisscas.wind_data_koshava wkdat on (wk.gw_id = wkdat.gw_id) inner join wisscas.wind_data_sterenn wstdat on (wst.gw_id = wstdat.gw_id) wk.scn_id = 177  , wk.azim between 2 , 3  , wkdat.dist = 6160 , wst.scn_id = 252 , wst.azim between 262 , 263  , wstdat.dist = 2480 limit 0,5000; 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -