tiledbsoma.io.update_obs¶
- tiledbsoma.io.update_obs(exp: Experiment, new_data: DataFrame, *, context: SOMATileDBContext | None = None, platform_config: Dict[str, Mapping[str, Any]] | object | None = None, default_index_name: str = 'obs_id') None¶
Replace the entire
obsDataFrame with the contents of a newpandas.DataFrame.- Details:
This performs an in-place schema + data replacement of the
Experiment’sobsDataFrame using the providednew_data. The operation:Adds any columns present in
new_databut absent in existingobsDrops any columns from the existing
obsthat are absent fromnew_dataRequires the row count and order to match the existing
obs(no join/merge is performed)
- Supported Workflow:
To avoid data misalignment, the following workflow is recommended:
Read the entire existing
obsinto memory.Modify values / add or drop columns while preserving row order.
Pass the modified DataFrame as
new_data.
- Parameters:
exp –
Experimentopened for write.new_data – A
pandas.DataFramecontaining the final desired data for the existingobsDataFrame.context – Optional
SOMATileDBContextcontaining storage parameters, etc.platform_config – Platform-specific options used to update this array, provided in the form
{"tiledb": {"create": {"dataframe_dim_zstd_level": 7}}}.default_index_name – Name to assign the index column if it is unnamed or is named
"index"in thenew_dataclass:pandas.DataFrame.
See also
update_var()for updating a specificMeasurement’svarDataFrame.
Lifecycle
Maturing.