Python&Excel: 複利を計算

複利の計算方法です。

 

I.Excelの場合

 

 

 

II.Pythonの場合

 

現在の定期預金の金利0.01%の場合

Runをクリックするとグラフが表示されます。
また、IPython Shellをクリックすると利子の表が表示されます。
 

import matplotlib.pyplot as plt import pandas as pd # put starting principle and rate of interest principal = 100000 interest = .0001 my_df= [] for year in range(0,11): d = { 'return': principal * ( 1.0 + interest ) ** year, 'year':year, } my_df.append(d) my_df = pd.DataFrame(my_df) print(my_df) my_df.plot.bar(x='year', y='return', rot=0, colormap='Paired', title='Compound Interest 0.01%' ) plt.show()

 
 
バブル時の金利8.0%の場合
 

import matplotlib.pyplot as plt import pandas as pd # put starting principle and rate of interest principal = 100000 interest = .080 my_df= [] for year in range(0,11): d = { 'return': principal * ( 1.0 + interest ) ** year, 'year':year, } my_df.append(d) my_df = pd.DataFrame(my_df) print(my_df) my_df.plot.bar(x='year', y='return', rot=0, colormap='Paired', title='Compound Interest 8% in the bubble economy period' ) plt.show()

 
現在のカードローンの金利3.8%の場合
 

import matplotlib.pyplot as plt import pandas as pd# put starting principle and rate of interest principal = 100000 interest = .038 my_df= [] for year in range(0,11): d = { 'return': principal * ( 1.0 + interest ) ** year, 'year':year, } my_df.append(d) my_df = pd.DataFrame(my_df) print(my_df) my_df.plot.bar(x='year', y='return', rot=0, colormap='Paired', title='Compound Interest 3.8% with a credit-card loan' ) plt.show()

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.