contango.trading.analysis.data.data_prep
contango.trading.analysis.data.data_prep
get_param_columns
get_param_columns(df: DataFrame, exclude_constant: bool = True) -> list[str]
Returns the columns in df that represent swept strategy parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame produced by |
required |
exclude_constant
|
bool
|
If True (default), drop parameters that only take a single unique value across all rows. |
True
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of parameter column names. |
Source code in src\contango\trading\analysis\data\data_prep.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
results_to_dataframe
results_to_dataframe(experiments: list[GraphingExperiment]) -> pd.DataFrame
Flattens a list of GraphingExperiment instances into a DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiments
|
list[GraphingExperiment]
|
The list of GraphingExperiment instances. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame with one row per experiment. |
Source code in src\contango\trading\analysis\data\data_prep.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |