Skip to content

Commit 6f9b1ff

Browse files
authored
Merge pull request #354 from jimportico/flexible_binning_issue336
Addressing issue #336
2 parents 76f4f0e + a462213 commit 6f9b1ff

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

alphalens/tears.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,16 @@ def create_turnover_tear_sheet(factor_data, turnover_periods=None):
410410

411411
quantile_factor = factor_data['factor_quantile']
412412

413-
quantile_turnover = \
414-
{p: pd.concat([perf.quantile_turnover(quantile_factor, q, p)
415-
for q in range(1, int(quantile_factor.max()) + 1)],
416-
axis=1)
417-
for p in turnover_periods}
413+
quantile_turnover = {
414+
p: pd.concat(
415+
[
416+
perf.quantile_turnover(quantile_factor, q, p)
417+
for q in quantile_factor.sort_values().unique().tolist()
418+
],
419+
axis=1,
420+
)
421+
for p in turnover_periods
422+
}
418423

419424
autocorrelation = pd.concat(
420425
[perf.factor_rank_autocorrelation(factor_data, period) for period in

0 commit comments

Comments
 (0)