def _makeInferredRow(self, row): cashFlow = int(str(row[2].strip())) expenses = str(row[3].strip()) roc = str(row[4].strip()) income = str(row[6].strip()) expenses = int(expenses or 0) roc = int(roc or 0) income = int(income or 0) net = cashFlow otherValue = None typeID = None if expenses == 0: net -= roc otherValue = roc temp = self._findResult(row, 4) typeID = self._findNamedType(temp, "Return of Capital") elif roc == 0: net -= expenses otherValue = expenses temp = self._findResult(row, 3) typeID = self._findNamedType(temp, "Expenses") else: raise ValueError("Invalid data for inferred row") fundID = row[0] date = datetime.strptime(row[1], '%m/%d/%y') net = str(net) otherValue = str(otherValue) notes = row[12] netRow = CashFlow.CashFlow(fundID, date, net, typeID, notes) otherRow = CashFlow.CashFlow(fundID, date, otherValue, typeID, notes) self._processCashFlow(netRow) self._processCashFlow(otherRow)
def _makeInferredRow(self, row): cashFlow = row['Cash Flow'] expenses = row['Expenses'] roc = row['ROC'] income = row['Income'] net = cashFlow otherValue = None typeID = None if pd.isna(expenses): net -= roc otherValue = roc temp = self._findResult(row, 'ROC') typeID = self._findNamedType(temp, "Return of Capital") elif pd.isna(roc): net -= expenses otherValue = expenses temp = self._findResult(row, 'Expenses') typeID = self._findNamedType(temp, "Expenses") else: raise ValueError("Invalid data for inferred row") fundID = row['Fund Code'] date = row['Date'] notes = row['Notes'] netRow = CashFlow.CashFlow(fundID, date, net, typeID, notes) otherRow = CashFlow.CashFlow(fundID, date, otherValue, typeID, notes) self._processCashFlow(netRow) self._processCashFlow(otherRow)
def _makeQtr(self, row): fundID = row[0] date = datetime.strptime(row[1], '%m/%d/%y') value = row[11] typeID = self._findNamedType('Balance', 'Quarterly Valuation') notes = row[12] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeSimpleRow(self, row): fundID = row[0] date = datetime.strptime(row[1], '%m/%d/%y') value = row[2] typeID = self._findSimpleTypeID(row) notes = row[12] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeSimpleRow(self, row): fundID = row['Fund Code'] date = row['Date'] value = row['Cash Flow'] typeID = self._findSimpleTypeID(row) notes = row['Notes'] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeQtr(self, row): fundID = row['Fund Code'] date = row['Date'] value = row['Qtr Valuation'] typeID = self._findNamedType('Balance', 'Quarterly Valuation') notes = row['Notes'] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeInitialCommitment(self, row): fundID = row['Fund Code'] date = row['Date'] value = row['Commitment'] typeID = self._findNamedType('Balance', 'Initial Commitment') notes = row['Notes'] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeInitialCommitment(self, row): fundID = row[0] print row date = datetime.strptime(row[1], '%m/%d/%y') value = row[10] typeID = self._findNamedType('Balance', 'Initial Commitment') notes = row[12] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeComplexRow(self, row): useCases = ("Expenses", "Return of Capital", "Subject to Recall", "Income") for i in range(3, 7): if row[i] != "": fundID = row[0] date = datetime.strptime(row[1], '%m/%d/%y') value = row[i] temp = self._findResult(row, i) typeID = self._findNamedType(temp, useCases[i - 3]) notes = row[12] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)
def _makeComplexRow(self, row): useCases = { 'Expenses': 'Expenses', 'ROC': 'Return of Capital', 'Dist. Sub. To Recall': 'Subject to Recall', 'Income': 'Income' } for case in useCases: if pd.notna(row[case]): fundID = row['Fund Code'] date = row['Date'] value = row[case] temp = self._findResult(row, case) typeID = self._findNamedType(temp, useCases[case]) notes = row['Notes'] result = CashFlow.CashFlow(fundID, date, value, typeID, notes) self._processCashFlow(result)