From 346e4bc89b7b95d95caef62926801eb1afe5ec9e Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:01:26 -0700 Subject: [PATCH] hotfix/options-stats-index-rename: renames the index column to 'strike' when `get_stats('strike')` (#5160) * renames the index column to 'strike' when get_stats('strike') * black --------- Co-authored-by: James Maslek --- openbb_terminal/stocks/options/options_chains_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openbb_terminal/stocks/options/options_chains_model.py b/openbb_terminal/stocks/options/options_chains_model.py index 67eac1d089f..319c61ab240 100644 --- a/openbb_terminal/stocks/options/options_chains_model.py +++ b/openbb_terminal/stocks/options/options_chains_model.py @@ -1158,9 +1158,9 @@ def calculate_stats(options: object, by: Optional[str] = "expiration") -> pd.Dat stats["Total Volume"] = stats["Calls Volume"] + stats["Puts Volume"] stats["Volume Ratio"] = round(stats["Puts Volume"] / stats["Calls Volume"], 2) stats["Vol-OI Ratio"] = round(stats["Total Volume"] / stats["Total OI"], 2) - if by == "strike": - stats.rename_axis("Strike", inplace=True) stats.rename_axis("Expiration", inplace=True) + if by == "strike": + stats.rename_axis(index={"Expiration": "Strike"}, inplace=True) return stats.replace([np.nan, np.inf], None)