atoti.Session.read_pandas()#

Session.read_pandas(dataframe, /, *, data_types=frozendict({}), default_values=frozendict({}), keys=frozenset({}), partitioning=None, table_name, **kwargs)#

Read a pandas DataFrame into a table.

Note

This is just a shortcut for:

inferred_data_types = session.tables.infer_data_types(dataframe)
table = session.create_table(
    table_name,
    data_types={**inferred_data_types, **data_types},
    default_values=...,
    keys=...,
    partitioning=...,
)
table.load(dataframe)

The longer version unlocks better performance because it can be split to move the load() call inside a data_transaction().

All the named indices of the DataFrame are included into the table. Multilevel columns are flattened into a single string name.

Parameters:
  • data_types (Mapping[str, DataType]) – Data types for some or all columns of the table. Data types for non specified columns will be inferred from the dataframe dtypes.

  • dataframe (pd.DataFrame) – The DataFrame to load.

  • default_values (Mapping[str, Constant | None]) – See create_table()’s default_values.

  • keys (AbstractSet[str] | Sequence[str]) – See create_table()’s keys.

  • partitioning (str | None) – See create_table()’s partitioning.

  • table_name (str) – See create_table()’s name.

  • kwargs (Unpack[_ReadPandasPrivateParameters])

Return type:

Table