mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
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 <jmaslek11@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user