Skip to content

Commit aa4b707

Browse files
author
Calvin DeBoer
committed
multi-dimensional indexing is deprecated in pandas.
1 parent b026b4e commit aa4b707

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

empyrical/stats.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,10 +1383,14 @@ def beta_aligned(returns, factor_returns, risk_free=0.0, out=None):
13831383

13841384
returns_1d = returns.ndim == 1
13851385
if returns_1d:
1386-
returns = returns[:, np.newaxis]
1386+
returns = (returns[:, np.newaxis]
1387+
if isinstance(returns, np.ndarray) else
1388+
returns.values[:, np.newaxis])
13871389

13881390
if factor_returns.ndim == 1:
1389-
factor_returns = factor_returns[:, np.newaxis]
1391+
factor_returns = (factor_returns[:, np.newaxis]
1392+
if isinstance(factor_returns, np.ndarray) else
1393+
factor_returns.values[:, np.newaxis])
13901394

13911395
N, M = returns.shape
13921396

0 commit comments

Comments
 (0)