Expand type specializations and multiple "by" parameters in merge_asof() · Issue #13936 · pandas-dev/pandas (original) (raw)

pd.merge_asof() can take an integer or floating-point number in the on parameter, and it can take an integer or an object in the by parameter. Specifically, the user's types are promoted to int64_t, double, or object as needed. That means, for example, that an int32_t is permitted, but we'll have to create a copy of the user's column to promote to int64_t.

This brings a question of whether we should add type specializations for every integer and floating-point number for better performance.

A second issue to consider is that only one column is permitted in the by parameter. But the user may wish to match on both ticker symbol and stock exchange, for example. To allow for this, the implementation logic would need to allow arrays of objects/integers for our grouping.