Skip to content

Instantly share code, notes, and snippets.

cash_flow['PV'] = cash_flow['Cash'] / (1 + inflation_rate) ** cash_flow['Year']
print(round(cash_flow))
cash_flow['Cash'] = rent_payment * (1 + rent_growth) ** (cash_flow['Year'] - 1)
print(round(cash_flow))
rent_payment = 800
time = 5
rent_growth = 0.06
inflation_rate = 0.03
cash_flow = pd.DataFrame({'Year': np.arange(1,6),
'Cash': rent_payment})
print(cash_flow)
payment = 200000
time = 5
rate = 0.06
cash_flow = pd.DataFrame({'Period': np.arange(1, 6),
'PMT': payment})
print(cash_flow)
r = 0.03
cash_flow['PV'] = cash_flow['Cash'] / (1 + r) ** cash_flow['Year']
npv = cash_flow['PV'].sum()
print('NPV is', + round(npv))
# NPV is 1596.0
# Calculate NPV of uneven cash flows
cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6],
'Cash': [150, 200, 250, 350, 400, 450]})
print(cash_flow)
print('NPV is', + round(npv))
# NPV is 1083.0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
r = 0.03
cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6],
'Cash': [200, 200, 200, 200, 200, 200]})
# PV (Present Value) = Cash (at period 1) / (1 + r)^n
cash_flow['PV'] = cash_flow['Cash'] / (1.0 + r) ** cash_flow['Year']
npv = cash_flow['PV'].sum()
const price = btcPrices[month];
if (!price) {
invalidMonthRange();
return;
}
const lastPrice = btcPrices.lastMonth;
console.log(`Price for month ${month} was ${price}`);
console.log(`While the price for the last month was: ${lastPrice}`);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.