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

Function test_stream_write_dispatch

python/pyarrow/tests/test_ipc.py:361–378  ·  view source on GitHub ↗
(stream_fixture)

Source from the content-addressed store, hash-verified

359
360@pytest.mark.pandas
361def test_stream_write_dispatch(stream_fixture):
362 # ARROW-1616
363 df = pd.DataFrame({
364 'one': np.random.randn(5),
365 'two': pd.Categorical(['foo', np.nan, 'bar', 'foo', 'foo'],
366 categories=['foo', 'bar'],
367 ordered=True)
368 })
369 table = pa.Table.from_pandas(df, preserve_index=False)
370 batch = pa.RecordBatch.from_pandas(df, preserve_index=False)
371 with stream_fixture._get_writer(stream_fixture.sink, table.schema) as wr:
372 wr.write(table)
373 wr.write(batch)
374
375 table = (pa.ipc.open_stream(pa.BufferReader(stream_fixture.get_source()))
376 .read_all())
377 assert_frame_equal(table.to_pandas(),
378 pd.concat([df, df], ignore_index=True))
379
380
381@pytest.mark.pandas

Callers

nothing calls this directly

Calls 4

BufferReaderMethod · 0.80
get_sourceMethod · 0.80
_get_writerMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected