Skip to content

Instantly share code, notes, and snippets.

@zachlim98
Created January 22, 2021 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlim98/bb641b2cca0f554040e8374aea8a12a0 to your computer and use it in GitHub Desktop.
Save zachlim98/bb641b2cca0f554040e8374aea8a12a0 to your computer and use it in GitHub Desktop.
pop = 7.594 #in billions
growth_rate = 1.0124
yearlist = []
poplist = []
for i,d in enumerate(np.arange(2021,2051)):
year = d
pop = pop * growth_rate**(i+1)
yearlist.append(year)
poplist.append(pop)
pop_growth = pd.DataFrame(
{
"Year" : yearlist,
"Population" : poplist
}
)
plt.plot(pop_growth.Year, pop_growth.Population)
plt.xlabel("Year")
plt.ylabel("Population Size")
plt.title("World Population Projected Growth")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment