James McCool
commited on
Commit
·
3ca2ebf
1
Parent(s):
521dad6
Refactor stratification logic to ensure proper selection of indices by adding break statements for clarity and control flow.
Browse files
global_func/stratification_function.py
CHANGED
|
@@ -31,9 +31,11 @@ def stratification_function(portfolio: pd.DataFrame, lineup_target: int, exclude
|
|
| 31 |
selected_indices = selected_indices[:lineup_target]
|
| 32 |
print(len(selected_indices))
|
| 33 |
range_var = 10
|
|
|
|
| 34 |
elif len(selected_indices) == lineup_target:
|
| 35 |
print(len(selected_indices))
|
| 36 |
range_var = 10
|
|
|
|
| 37 |
else:
|
| 38 |
base_target += 5 * range_var
|
| 39 |
|
|
|
|
| 31 |
selected_indices = selected_indices[:lineup_target]
|
| 32 |
print(len(selected_indices))
|
| 33 |
range_var = 10
|
| 34 |
+
break
|
| 35 |
elif len(selected_indices) == lineup_target:
|
| 36 |
print(len(selected_indices))
|
| 37 |
range_var = 10
|
| 38 |
+
break
|
| 39 |
else:
|
| 40 |
base_target += 5 * range_var
|
| 41 |
|