Overview

Remove specific rows from an existing experiment dataset.

Method Signature

# Synchronous
client.experiments.remove_rows(
    experiment_id: str,
    row_ids: List[str]
) -> Dict[str, Any]

# Asynchronous
await client.experiments.remove_rows(
    experiment_id: str,
    row_ids: List[str]
) -> Dict[str, Any]

Parameters

experiment_id
string
required
The unique identifier of the experiment
row_ids
List[str]
required
List of row IDs to remove from the experiment

Returns

Returns a dictionary containing the updated experiment information.

Example

from keywordsai import KeywordsAI

client = KeywordsAI(api_key="your-api-key")

# Remove specific rows from experiment
row_ids_to_remove = ["row_123", "row_456"]

result = client.experiments.remove_rows(
    experiment_id="exp_123",
    row_ids=row_ids_to_remove
)

print(f"Removed {len(row_ids_to_remove)} rows from experiment")

Error Handling

try:
    result = client.experiments.remove_rows(
        experiment_id="exp_123",
        row_ids=["row_123", "row_456"]
    )
except Exception as e:
    print(f"Error removing rows: {e}")