docstr: Create an arrow binary from a Pandas dataframe.
  
  Args:
      df (:obj:`pandas.DataFrame`)
      schema (:obj:`pyarrow.Schema`)
      legacy (bool): if True, use legacy IPC format (pre-pyarrow 0.15). Defaults to False.
  
  Returns:
      bytes : a bytes object containing the arrow-serialized output.
docstr_tok: ["Create","an","arrow","binary","from","a","Pandas","dataframe",".","Args",":","df","(",":","obj",":","`","pandas.DataFrame","`",")","schema","(",":","obj",":","`","pyarrow.Schema","`",")","legacy","(","bool",")",":","if","True",",","use","legacy","IPC","format","(","pre-pyarrow","0.15",")",".","Defaults","to","False",".","Returns",":","bytes",":","a","bytes","object","containing","the","arrow-serialized","output","."]
code: def make_arrow_from_pandas(df, schema=None, legacy=False):
      """Create an arrow binary from a Pandas dataframe.
  
      Args:
          df (:obj:`pandas.DataFrame`)
          schema (:obj:`pyarrow.Schema`)
          legacy (bool): if True, use legacy IPC format (pre-pyarrow 0.15). Defaults to False.
  
      Returns:
          bytes : a bytes object containing the arrow-serialized output.
      """
      stream = pa.BufferOutputStream()
      table = pa.Table.from_pandas(df, schema=schema)
  
      writer = pa.RecordBatchStreamWriter(
          stream, table.schema, use_legacy_format=legacy
      )
  
      writer.write_table(table)
      writer.close()
      return stream.getvalue().to_pybytes()
  
imports: from datetime import datetime
  import numpy
  import pandas
  import pyarrow
  from pytest import fixture
  from random import random, randint, choice
  from faker import Faker
label_desc: Use image node_id 2 for calling the Util obj's underlying member method code with example usage: obj.make_arrow_from_pandas(df, schema, legacy) and returns: stream