You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in the current release (0.0.63 & 0.0.64):
In line 862 of reports.py, when calculating Omega, the passing param is df['returns']. However, when passing a returns with multiple columns, the column names are converted to ['returns_1', 'returns_2', ...]. Therefore we will see the error below:
File /opt/kernel/lib/python3.9/site-packages/quantstats/reports.py:862, in metrics(returns, benchmark, rf, display, mode, sep, compounded, periods_per_year, prepare_returns, match_dates, **kwargs)
860 metrics["Smart Sortino/√2"] = metrics["Smart Sortino"] / _sqrt(2)
861 # metrics['Prob. Smart Sortino/√2 Ratio %'] = _stats.probabilistic_adjusted_sortino_ratio(df, rf, win_year, False, True) * pct
--> 862 metrics["Omega"] = _stats.omega(df["returns"], rf, 0.0, win_year)
864 metrics["~~~~~~~~"] = blank
865 metrics["Max Drawdown %"] = blank
File /opt/kernel/lib/python3.9/site-packages/pandas/core/frame.py:3807, in DataFrame.__getitem__(self, key)
3805 if self.columns.nlevels > 1:
3806 return self._getitem_multilevel(key)
-> 3807 indexer = self.columns.get_loc(key)
3808 if is_integer(indexer):
3809 indexer = [indexer]
File /opt/kernel/lib/python3.9/site-packages/pandas/core/indexes/base.py:3804, in Index.get_loc(self, key, method, tolerance)
3802 return self._engine.get_loc(casted_key)
3803 except KeyError as err:
-> 3804 raise KeyError(key) from err
3805 except TypeError:
3806 # If we have a listlike key, _check_indexing_error will raise
3807 # InvalidIndexError. Otherwise we fall through and re-raise
3808 # the TypeError.
3809 self._check_indexing_error(key)
KeyError: 'returns'
The text was updated successfully, but these errors were encountered:
There is a bug in the current release (0.0.63 & 0.0.64):
In line 862 of
reports.py
, when calculatingOmega
, the passing param isdf['returns']
. However, when passing a returns with multiple columns, the column names are converted to ['returns_1', 'returns_2', ...]. Therefore we will see the error below:The text was updated successfully, but these errors were encountered: