0

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.

Mario
  • 1,631
  • 2
  • 21
  • 51
mike
  • 1
  • 1
  • Hi, welcome to StackOverflow. Please take the [tour](https://stackoverflow.com/tour) and learn [How to Ask](https://stackoverflow.com/help/how-to-ask). In order to get help, you will need to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). If your question include a pandas dataframe, please provide a [reproducible pandas example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – alec_djinn Mar 29 '23 at 13:31

0 Answers0