Skip to content

Commit aa05aa0

Browse files
author
Scott Sanderson
committed
BUG: Preserve output index in cum_returns.
1 parent 52687e1 commit aa05aa0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

empyrical/stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ def cum_returns(returns, starting_value=0, out=None):
233233

234234
if allocated_output:
235235
if returns.ndim == 1 and isinstance(returns, pd.Series):
236-
out = pd.Series(out)
236+
out = pd.Series(out, index=returns.index)
237237
elif isinstance(returns, pd.DataFrame):
238-
out = pd.DataFrame(out)
238+
out = pd.DataFrame(out, index=returns.index)
239239

240240
return out
241241

0 commit comments

Comments
 (0)