diff options
| -rw-r--r-- | python/reto.py | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/python/reto.py b/python/reto.py index 47312717..d773c354 100644 --- a/python/reto.py +++ b/python/reto.py @@ -106,25 +106,16 @@ def transform_df(df): "spread_shock": "spread_shock", "CASH_BASIS": "CASH_BASIS", "HEDGE_CLO": "HEDGE_CLO", - "TEST": "TEST", } ) df = df.reset_index().rename(columns={"level_0": "unit"}) - - # Get the list of strategy columns by slicing the `df.columns` array strategy_columns = df.columns[3:] - - # Create a new dataframe with the desired format, using the dynamic list of strategy columns df = pd.melt( df, id_vars=["unit", "date", "spread_shock"], value_vars=strategy_columns ) - - # Rename the columns to the desired names df = df.rename( columns={"variable": "strategy", "value": "value", "unit": "output_type"} ) - - # Print the new dataframe to check return df |
