Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ordered_merge improvements #1870

Closed
wesm opened this issue Sep 9, 2012 · 6 comments
Closed

ordered_merge improvements #1870

wesm opened this issue Sep 9, 2012 · 6 comments
Labels
Datetime Datetime data dtype Enhancement
Milestone

Comments

@wesm
Copy link
Member

wesm commented Sep 9, 2012

http://stackoverflow.com/questions/12322289/kdb-like-asof-join-for-timeseries-data-in-pandas/12336039#12336039

@leonbaum
Copy link

It would be great to be able to perform ordered left joins using a time-series index as well.

@yarivm
Copy link

yarivm commented Jan 24, 2013

+1 vote for "ordered left joins."

@ngcrawford
Copy link

+1 vote for "ordered left joins.

@chrisaycock
Copy link
Contributor

Any thoughts on this? A kdb-style asof-join is very useful in time-series analysis. The rows of the right-hand table would just be picked via a DataFrame.asof (see #2941).

@jreback
Copy link
Contributor

jreback commented Sep 4, 2014

http://pandas.pydata.org/pandas-docs/stable/merging.html?highlight=ordered_merge#merging-ordered-data

(unless something else was meant here). This has been in for a while.

@chrisaycock
Copy link
Contributor

@jreback Unlike the pd.ordered_merge(), the kdb aj() only keeps the rows from the left-hand table.

http://code.kx.com/wiki/Reference/aj

I.e., as with a regular left-join, the table doesn't get more rows; it just appends columns from the right-hand table.

Actually, it's very similar to a left-join, but instead of searching for equal keys, it searches for the greatest key from the right-hand table that is less-than-or-equal-to the key from the left-hand table. This is exactly what the asof function does in pandas, so we're part of the way there already.

jreback added a commit to jreback/pandas that referenced this issue Jun 15, 2016
ENH: add DataFrame.asof

ENH: add pd.asof_merge

closes pandas-dev#1870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants