Created
September 16, 2018 20:40
-
-
Save marknagelberg/a302de8904f0a5f3e3f739be84723dd3 to your computer and use it in GitHub Desktop.
Creating Pandas Dataframes for PDF in Python Blog Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
interest_rates = [i*.01 for i in range(1,11)] | |
initial_account_sizes = [100, 500, 20000, 50000] | |
data_frames = [] | |
for interest_rate in interest_rates: | |
df = {} | |
for initial_account_size in initial_account_sizes: | |
df['Account Size: ' + str(initial_account_size)] = [initial_account_size * (1 + interest_rate) ** year for year in range(1, 21)] | |
df = pd.DataFrame(df) | |
df.index.name = 'year' | |
data_frames.append({'df':df, | |
'interest_rate':interest_rate}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment