Skip to content

Commit 52687e1

Browse files
Joe Jevnikllllllllll
authored andcommitted
BUG: truncate windows
1 parent a39a323 commit 52687e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

empyrical/stats.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ def unary_vectorized_roll(arr, window, out=None, **kwargs):
4949
allocated_output = out is None
5050

5151
if len(arr):
52-
out = function(rolling_window(arr, window).T, out=out, **kwargs)
52+
out = function(
53+
rolling_window(arr, min(len(arr), window)).T,
54+
out=out,
55+
**kwargs
56+
)
5357
else:
5458
out = np.empty(0, dtype='float64')
5559

@@ -93,8 +97,8 @@ def binary_vectorized_roll(lhs, rhs, window, out=None, **kwargs):
9397

9498
if window >= 1 and len(lhs) and len(rhs):
9599
out = function(
96-
rolling_window(lhs, window).T,
97-
rolling_window(rhs, window).T,
100+
rolling_window(lhs, min(len(lhs), window)).T,
101+
rolling_window(rhs, min(len(rhs), window)).T,
98102
out=out,
99103
**kwargs
100104
)

0 commit comments

Comments
 (0)