@@ -327,7 +327,9 @@ def _build_tax_unit_mortgage_receiver(
327327 person_tax_unit_ids = np .asarray (person_tax_unit_ids )
328328 is_head = np .asarray (is_head , dtype = bool )
329329 n_tax_units = len (tax_unit_ids )
330- tax_unit_index = {int (tax_unit_id ): idx for idx , tax_unit_id in enumerate (tax_unit_ids )}
330+ tax_unit_index = {
331+ int (tax_unit_id ): idx for idx , tax_unit_id in enumerate (tax_unit_ids )
332+ }
331333 person_tax_unit_idx = np .array (
332334 [tax_unit_index [int (tax_unit_id )] for tax_unit_id in person_tax_unit_ids ],
333335 dtype = np .int32 ,
@@ -418,13 +420,9 @@ def _build_scf_mortgage_donor(scf: pd.DataFrame) -> pd.DataFrame:
418420 donor ["is_female" ] = _frame_column (scf , "is_female" )
419421 donor ["cps_race" ] = _frame_column (scf , "cps_race" )
420422 donor ["is_married" ] = _frame_column (scf , "is_married" )
421- donor ["own_children_in_household" ] = _frame_column (
422- scf , "own_children_in_household"
423- )
423+ donor ["own_children_in_household" ] = _frame_column (scf , "own_children_in_household" )
424424 donor ["employment_income" ] = _frame_column (scf , "employment_income" )
425- donor ["interest_dividend_income" ] = _frame_column (
426- scf , "interest_dividend_income"
427- )
425+ donor ["interest_dividend_income" ] = _frame_column (scf , "interest_dividend_income" )
428426 donor ["social_security_pension_income" ] = _frame_column (
429427 scf , "social_security_pension_income"
430428 )
@@ -527,7 +525,11 @@ def _tax_unit_mortgage_owner_status(
527525 spm_tenure = data .get ("spm_unit_tenure_type" , {}).get (time_period )
528526 person_spm_unit_id = data .get ("person_spm_unit_id" , {}).get (time_period )
529527 spm_unit_ids = data .get ("spm_unit_id" , {}).get (time_period )
530- if spm_tenure is not None and person_spm_unit_id is not None and spm_unit_ids is not None :
528+ if (
529+ spm_tenure is not None
530+ and person_spm_unit_id is not None
531+ and spm_unit_ids is not None
532+ ):
531533 spm_map = {
532534 int (spm_unit_id ): _decode_owner_status (value )
533535 for spm_unit_id , value in zip (spm_unit_ids , spm_tenure )
@@ -723,9 +725,13 @@ def _split_interest_by_balance(
723725
724726 with_second = total_balance > 0
725727 first_interest [with_second ] = (
726- total_interest [with_second ] * first_balance [with_second ] / total_balance [with_second ]
728+ total_interest [with_second ]
729+ * first_balance [with_second ]
730+ / total_balance [with_second ]
731+ )
732+ second_interest [with_second ] = (
733+ total_interest [with_second ] - first_interest [with_second ]
727734 )
728- second_interest [with_second ] = total_interest [with_second ] - first_interest [with_second ]
729735
730736 no_second = second_balance == 0
731737 first_interest [no_second ] = total_interest [no_second ]
0 commit comments