daft.from_pandas

Contents

daft.from_pandas#

from_pandas(data: Union[pd.DataFrame, List[pd.DataFrame]]) DataFrame[source]#

Creates a Daft DataFrame from a pandas DataFrame.

Example

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

(Showing first 3 of 3 rows)
Parameters:

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

Returns:

Daft DataFrame created from the provided pandas DataFrame.

Return type:

DataFrame