daft.from_arrow

Contents

daft.from_arrow#

from_arrow(data: Union[pa.Table, List[pa.Table], Iterable[pa.Table]]) DataFrame[source]#

Creates a DataFrame from a pyarrow Table.

Example

>>> import pyarrow as pa
>>> import daft
>>> t = pa.table({"a": [1, 2, 3], "b": ["foo", "bar", "baz"]})
>>> df = daft.from_arrow(t)
>>> df.show()
╭───────┬──────╮
│ a     ┆ b    │
│ ---   ┆ ---  │
│ Int64 ┆ Utf8 │
╞═══════╪══════╡
│ 1     ┆ foo  │
├╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
│ 2     ┆ bar  │
├╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
│ 3     ┆ baz  │
╰───────┴──────╯

(Showing first 3 of 3 rows)
Parameters:

data – pyarrow Table(s) that we wish to convert into a Daft DataFrame.

Returns:

DataFrame created from the provided pyarrow Table.

Return type:

DataFrame