tiledbsoma.Collection.add_new_dataframe¶
- Collection.add_new_dataframe(key: str, *, uri: str | None = None, schema: pa.Schema, index_column_names: Sequence[str] = ('soma_joinid',), domain: Domain | None = None, platform_config: options.PlatformConfig | None = None) DataFrame ¶
Adds a new DataFrame to this collection.
For details about the behavior of
key
anduri
, seeadd_new_collection()
. The remaining parameters are passed toDataFrame.create()
unchanged.Examples
>>> import tiledbsoma >>> import pandas as pd >>> import pyarrow as pa >>> df = pd.DataFrame(data={"soma_joinid": [0, 1], "col1": [1, 2], "col2": [3, 4]}) ... with tiledbsoma.Collection.create("/tmp/collection") as soma_collection: ... soma_df = soma_collection.add_new_dataframe( ... "a_dataframe", schema=pa.Schema.from_pandas(df), domain=[[0,9]], ... ) ... soma_df.write(pa.Table.from_pandas(df, preserve_index=False)) ... >>> with tiledbsoma.open("/tmp/collection") as soma_collection: ... data = soma_collection['a_dataframe'].read().concat().to_pandas() ... >>> data soma_joinid col1 col2 0 0 1 3 1 1 2 4
Lifecycle
Maturing.