I'm using the below to pull a unique Customer ID
from an excel column in loan_tape
, and then only include the Customer ID
if it's also in asset_tape
Borrower ID
. I'm looking to print a dataframe that shows Customer ID
on the y-axis, and program_names
on the x-axis, with the count of each program name in the actual frame, but I'm not sure of the syntax.
def clean_asset_tape(loan_tape, asset_tape, entity_map):
# Keep only borrowers that are included in the loan tape
unique_lt_borrowers = loan_tape['Customer ID'].unique()
asset_tape = asset_tape[asset_tape['Borrower ID'].isin(unique_lt_borrowers)]
# Include only the 'Total' program lines in the asset tape
program_names = entity_map['Asset Schedule Name']
asset_tape = asset_tape[asset_tape['Program'].isin(program_names)]
return asset_tape
I tried using a simple dataframe command with the two axes and a count function but I am having no luck. I'm still fairly new to python.