class_docstr: Benchmark in-memory streaming to a Pandas dataframe.
code: def setup(self, chunk_size):
      # Note we're careful to stream different chunks instead of
      # streaming N times the same chunk, so that we avoid operating
      # entirely out of L1/L2.
      chunks = generate_chunks(
          self.total_size,
          nchunks=self.total_size // chunk_size,
          ncols=self.ncols,
      )
      batches = [pa.RecordBatch.from_pandas(df) for df in chunks]
      schema = batches[0].schema
      sink = pa.BufferOutputStream()
      stream_writer = pa.RecordBatchStreamWriter(sink, schema)
      for batch in batches:
          stream_writer.write_batch(batch)
      self.source = sink.getvalue()
  
file_path: arrow/python/benchmarks/streaming.py
imports: import numpy
  import pandas
  import pyarrow
  from .None import common
  from .common import KILOBYTE, MEGABYTE
label_desc: Use image node_id 1 for calling the StreamReader obj's underlying member method code with example usage: obj.setup(chunk_size) without return types