So I have a very large dataset that has a lot of rows and columns. I'd like to instantiate instance variable properties for all rows of specific columns in the dataframe. I know of how to do this for single variables, but how would I would do this for all rows in a large dataframe? Below is what I've currently used to instantiate the properties of the last values in each column.
class Tranche:
#intializing conduit tranche
def __init__(self, rating, data):
self.rating = rating
self.df = historical_data
self.cpn = historical_data['Cpn'].iloc[-1]
self.price = historical_data['Price'].iloc[-1]
self.moddur = historical_data['ModDur'].iloc[-1]
self.oas = historical_data['OAS'].iloc[-1]