MCPcopy Create free account
hub / github.com/apache/arrow / test_dataset_join_asof

Function test_dataset_join_asof

python/pyarrow/tests/test_dataset.py:5383–5407  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

5381
5382@pytest.mark.dataset
5383def test_dataset_join_asof(tempdir):
5384 t1 = pa.Table.from_pydict({
5385 "colA": [1, 1, 5, 6, 7],
5386 "col2": ["a", "b", "a", "b", "f"]
5387 })
5388 ds.write_dataset(t1, tempdir / "t1", format="ipc")
5389 ds1 = ds.dataset(tempdir / "t1", format="ipc")
5390
5391 t2 = pa.Table.from_pydict({
5392 "colB": [2, 9, 15],
5393 "col3": ["a", "b", "g"],
5394 "colC": [1., 3., 5.]
5395 })
5396 ds.write_dataset(t2, tempdir / "t2", format="ipc")
5397 ds2 = ds.dataset(tempdir / "t2", format="ipc")
5398
5399 result = ds1.join_asof(
5400 ds2, on="colA", by="col2", tolerance=1,
5401 right_on="colB", right_by="col3",
5402 )
5403 assert result.to_table().sort_by("colA") == pa.table({
5404 "colA": [1, 1, 5, 6, 7],
5405 "col2": ["a", "b", "a", "b", "f"],
5406 "colC": [1., None, None, None, None],
5407 })
5408
5409
5410@pytest.mark.dataset

Callers

nothing calls this directly

Calls 1

to_tableMethod · 0.45

Tested by

no test coverage detected