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 obs DataFrame with the contents of a new pandas.DataFrame.

Details:

This performs an in-place schema + data replacement of the Experiment’s obs DataFrame using the provided new_data. The operation:

  • Adds any columns present in new_data but absent in existing obs

  • Drops any columns from the existing obs that are absent from new_data

  • Requires 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:

  1. Read the entire existing obs into memory.

  2. Modify values / add or drop columns while preserving row order.

  3. Pass the modified DataFrame as new_data.

Parameters:
  • expExperiment opened for write.

  • new_data – A pandas.DataFrame containing the final desired data for the existing obs DataFrame.

  • context – Optional SOMATileDBContext containing 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 the new_data class:pandas.DataFrame.

See also

  • update_var() for updating a specific Measurement’s var DataFrame.

Lifecycle

Maturing.