diff --git a/developer/sqftproforma.py b/developer/sqftproforma.py index c3323ac..fe58585 100644 --- a/developer/sqftproforma.py +++ b/developer/sqftproforma.py @@ -773,9 +773,10 @@ def _lookup_parking_cfg(self, form, parking_config, df, profit = profit.astype('float') profit[np.isnan(profit)] = -np.inf - if self.proposals_to_keep > 1: + proposals_to_keep_in_form = min(self.proposals_to_keep, fars.shape[0]) + if proposals_to_keep_in_form > 1: maxprofit_sorted_indexes = np.argsort(-profit, axis=0) - maxprofitind = maxprofit_sorted_indexes[:self.proposals_to_keep] + maxprofitind = maxprofit_sorted_indexes[:proposals_to_keep_in_form] else: maxprofitind = np.argmax(profit, axis=0) @@ -786,10 +787,10 @@ def twod_get(indexes, arr): arr = arr[indexes, np.arange(indexes.shape[1])] return arr.astype('float').flatten() - if self.proposals_to_keep == 1: + if proposals_to_keep_in_form == 1: outdf_index = df.index else: - outdf_index = np.tile(df.index, self.proposals_to_keep) + outdf_index = np.tile(df.index, proposals_to_keep_in_form) outdf = pd.DataFrame({ 'building_sqft': twod_get(maxprofitind, building_bulks),