Overview

Remove specific columns from an existing experiment dataset.

Method Signature

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

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

Parameters

experiment_id
string
required
The unique identifier of the experiment
column_names
List[str]
required
List of column names 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 columns from experiment
columns_to_remove = ["old_metric", "deprecated_field"]

result = client.experiments.remove_columns(
    experiment_id="exp_123",
    column_names=columns_to_remove
)

print(f"Removed {len(columns_to_remove)} columns from experiment")

Error Handling

try:
    result = client.experiments.remove_columns(
        experiment_id="exp_123",
        column_names=["old_metric", "deprecated_field"]
    )
except Exception as e:
    print(f"Error removing columns: {e}")