Rapidata results
RapidataResults #
Bases: dict
A specialized dictionary class for handling Rapidata API results. Extends the built-in dict class with specialized methods.
to_pandas #
Warning
This method is currently under development. The structure of the results may change in the future.
Converts the results to a pandas DataFrame.
For Compare results (exactly 2 assets), creates standardized A_/B_
columns for each metric (plus Both_/Neither_ when those options
are present). For Ranking results with N assets, creates one
<asset>_<metric> column per asset. For Classification results,
creates one row per datapoint and answer option, with option,
count, ratio, summedUserScore and summedUserScoreRatio
columns. For other results, flattens nested dictionaries into columns
with underscore-separated names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split_details
|
bool
|
If True, splits each datapoint by its detailed results, creating a row for each response with global metrics copied. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A DataFrame containing the processed results |
Raises:
| Type | Description |
|---|---|
ValueError
|
If split_details is True but no detailed results are found |
Source code in src/rapidata/rapidata_client/results/rapidata_results.py
to_json #
Saves the results to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The file path where the JSON should be saved. Defaults to "./results.json". |
'./results.json'
|