Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add "forward" and "nearest" direction to merge_asof() #14887
Comments
|
this is fine. also prob should add an example / expl in docs about how so should have:
|
jreback
added Reshaping Timeseries
labels
Dec 15, 2016
jreback
added this to the
Next Major Release
milestone
Dec 15, 2016
jreback
added Difficulty Intermediate Effort Medium
labels
Dec 15, 2016
|
I like the idea of a As for the difference between |
chrisaycock
changed the title from
Add a "forward" direction to merge_asof() to Add "forward" and "nearest" direction to merge_asof()
Jan 12, 2017
chrisaycock
referenced
this issue
Jan 13, 2017
Closed
ENH: Added 'direction' parameter to merge_asof() (#14887) #15129
jreback
modified the milestone: 0.20.0, Next Major Release
Jan 13, 2017
jreback
closed this
in cc36009
Jan 18, 2017
chrisaycock
referenced
this issue
Jan 19, 2017
Closed
merge_asof tolerance is not working in both directions #14680
AnkurDedania
added a commit
to AnkurDedania/pandas
that referenced
this issue
Mar 21, 2017
|
|
+ AnkurDedania |
66e0e20
|
chrisaycock commentedDec 15, 2016
•
edited
Currently
pd.merge_asof()looks backwards, meaning that it gets the last row from the right table whose timestamp is less the left table's timestamp. It might be nice to look forwards, meaning get the first row in the right table whose timestamps is greater than the left table's timestamp. And we could have a nearest, meaning get the row from the right table whose timestamp is closest to the left table's timestamp regardless of direction.I propose a new
directionparameter whose default value is"backward", which looks for prior timestamps aspd.merge_asof()currently does. A value of"forward"will cause cause the function to look for subsequent timestamps. A value of"nearest"will look on both directions.Here's a modified example from the docstring: