amol- commented on a change in pull request #12010:
URL: https://github.com/apache/arrow/pull/12010#discussion_r774506470
##########
File path: python/pyarrow/table.pxi
##########
@@ -671,13 +671,55 @@ cdef class RecordBatch(_PandasConvertible):
Returns
-------
RecordBatch
+
+ Examples
+ --------
+ >>> import pyarrow as pa
+ >>> pydict = {'int': [1, 2], 'str': ['a', 'b']}
+ >>> pa.RecordBatch.from_pydict(pydict)
+ pyarrow.RecordBatch
+ int: int64
+ str: string
"""
return _from_pydict(cls=RecordBatch,
mapping=mapping,
schema=schema,
metadata=metadata)
+ @staticmethod
+ def from_pylist(mapping, schema=None, metadata=None):
+ """
+ Construct a RecordBatch from Arrow arrays or columns.
+
+ Parameters
+ ----------
+ mapping : list of dicts or Mappings
+ A mapping of strings to Arrays or Python lists.
+ schema : Schema, default None
+ If not passed, will be inferred from the Mapping values.
+ metadata : dict or Mapping, default None
+ Optional metadata for the schema (if inferred).
+
+ Returns
+ -------
+ RecordBatch
+
+ Examples
+ --------
+ >>> import pyarrow as pa
+ >>> pylist = [{'int': [1, 2]}, {'str': ['a', 'b']}]
+ >>> pa.RecordBatch.from_pylist(pylist)
Review comment:
Agree, As a user I would personally find more obvious that it accepts a
list of rows whhen building a RecordBatch or Table.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]