我正在尝试使用Pandas的merge_asof
,但出现错误:
TypeError: Function call with ambiguous argument types
可复制的示例:
import pandas as pd
a = pd.DataFrame({'foo': [1., 2.], 'bar': ['2019-01-01 00:00:10', '2019-01-01 00:00:20']})
b = pd.DataFrame({'foo': [2., 5.], 'baz': ['2019-01-01 00:00:05', '2019-01-01 00:00:25']})
a['bar'] = pd.to_datetime(a['bar'])
b['baz'] = pd.to_datetime(b['baz'])
pd.merge_asof(a,
b,
left_on='bar',
right_on='baz',
direction='backward',
by='foo',
allow_exact_matches=False)
我尝试检查pandas.core.reshape.merge文件,但没有解决问题的运气