memtable
*, columns=None, schema=None, name=None) xorq.api.memtable(data,
Construct an ibis table expression from in-memory data.
Parameters
Name | Type | Description | Default |
---|---|---|---|
data | A table-like object (pandas.DataFrame , pyarrow.Table , or polars.DataFrame ), or any data accepted by the pandas.DataFrame constructor (e.g. a list of dicts). Note that ibis objects (e.g. MapValue ) may not be passed in as part of data and will result in an error. Do not depend on the underlying storage type (e.g., pyarrow.Table), it’s subject to change across non-major releases. |
required | |
columns | Iterable[str] | None | Optional of column names. If provided, must match the number of columns in data . |
None |
schema | SchemaLike | None | Optional Schema . The functions use data to infer a schema if not passed. |
None |
name | str | None | Optional name of the table. | None |
Returns
Name | Type | Description |
---|---|---|
Table | A table expression backed by in-memory data. |
Examples
>>> import ibis
>>> t = ibis.memtable([{"a": 1}, {"a": 2}])
>>> t
>>> t = ibis.memtable([{"a": 1, "b": "foo"}, {"a": 2, "b": "baz"}])
>>> t
Create a table literal without column names embedded in the data and pass columns
>>> t = ibis.memtable([(1, "foo"), (2, "baz")], columns=["a", "b"])
>>> t
Create a table literal without column names embedded in the data. Ibis generates column names if none are provided.
>>> t = ibis.memtable([(1, "foo"), (2, "baz")])
>>> t