Visualizing investment projections
The first thing we’re going to need is the ability to calculate the preceding projections year by year, so we can eventually plot the outcome. Let’s see how we can do that:
def returnProjectionByYear(expectedReturn, expectedRisk, initialInvestment, monthlyInvestment, years): from datetime import date import pandas as pd df = pd.DataFrame({'date': [], 'lowValue': [], 'value': [], 'highValue': []}) df.set_index('date') for year in range(years+1): newValue = returnProjection...