From 069a30b58d08f99aa60cc3929d898f7b0f8ef782 Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 1 Jul 2024 15:12:10 +1000 Subject: [PATCH 1/3] [inflation_history] ENH: Implement review suggestions and comments --- lectures/inflation_history.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index afb36a85..d03f0297 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -21,6 +21,7 @@ The `xlrd` package is used by `pandas` to perform operations on Excel files. ```{code-cell} ipython3 :tags: [hide-output] + !pip install xlrd ``` @@ -28,6 +29,7 @@ The `xlrd` package is used by `pandas` to perform operations on Excel files. ```{code-cell} ipython3 :tags: [hide-cell] + from importlib.metadata import version from packaging.version import Version @@ -100,16 +102,16 @@ mystnb: caption: Long run time series of the price level name: lrpl --- -df_fig5_bef1914 = df_fig5[df_fig5.index <= 1915] +df_fig5_befe1914 = df_fig5[df_fig5.index <= 1914] # Create plot cols = ['UK', 'US', 'France', 'Castile'] -fig, ax = plt.subplots(dpi=200) +fig, ax = plt.subplots(figsize=(10,6)) for col in cols: - ax.plot(df_fig5_bef1914.index, - df_fig5_bef1914[col], label=col, lw=2) + ax.plot(df_fig5_befe1914.index, + df_fig5_befe1914[col], label=col, lw=2) ax.legend() ax.set_ylabel('Index 1913 = 100') @@ -463,7 +465,6 @@ mystnb: caption: Price index and exchange rate (Hungary) name: pi_xrate_hungary --- -m_seq = df_hun['Notes in circulation'] p_seq = df_hun['Hungarian index of prices'] e_seq = 1 / df_hun['Cents per crown in New York'] From 58d65eedf4232a136eb7bf06e5769890f340e2e5 Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 22 Jul 2024 11:11:06 +1000 Subject: [PATCH 2/3] remove dots and show only moving average line --- lectures/inflation_history.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index d03f0297..73adc72c 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -329,11 +329,6 @@ def pr_plot(p_seq, index, ax): # Calculate the difference of log p_seq log_diff_p = np.diff(np.log(p_seq)) - # Graph for the difference of log p_seq - ax.scatter(index[1:], log_diff_p, - label='Monthly inflation rate', - color='tab:grey') - # Calculate and plot moving average diff_smooth = pd.DataFrame(log_diff_p).rolling(3, center=True).mean() ax.plot(index[1:], diff_smooth, label='Moving average (3 period)', alpha=0.5, lw=2) @@ -347,7 +342,7 @@ def pr_plot(p_seq, index, ax): for label in ax.get_xticklabels(): label.set_rotation(45) - ax.legend(loc='upper left') + ax.legend() return ax ``` From 32fa9ce359c06401552fd6292c0d0ae5ca3302c2 Mon Sep 17 00:00:00 2001 From: Longye Tian Date: Tue, 23 Jul 2024 14:56:33 +1000 Subject: [PATCH 3/3] update 1/cents per polish mark --- lectures/inflation_history.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 73adc72c..013954d4 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -416,7 +416,7 @@ p_seq = df_aus['Retail price index, 52 commodities'] e_seq = df_aus['Exchange Rate'] lab = ['Retail price index', - '1/cents per Austrian Krone (Crown)'] + 'Austrian Krones (Crowns) per US cent'] # Create plot fig, ax = plt.subplots(dpi=200) @@ -464,7 +464,7 @@ p_seq = df_hun['Hungarian index of prices'] e_seq = 1 / df_hun['Cents per crown in New York'] lab = ['Hungarian index of prices', - '1/cents per Hungarian Korona (Crown)'] + 'Hungarian Koronas (Crowns) per US cent'] # Create plot fig, ax = plt.subplots(dpi=200) @@ -533,7 +533,7 @@ e_seq[e_seq.index > '05-01-1924'] = np.nan ```{code-cell} ipython3 lab = ['Wholesale price index', - '1/cents per polish mark'] + 'Polish marks per US cent'] # Create plot fig, ax = plt.subplots(dpi=200) @@ -575,7 +575,7 @@ p_seq = df_deu['Price index (on basis of marks before July 1924,' e_seq = 1/df_deu['Cents per mark'] lab = ['Price index', - '1/cents per mark'] + 'Marks per US cent'] # Create plot fig, ax = plt.subplots(dpi=200) @@ -602,7 +602,7 @@ e_seq[e_seq.index > '12-01-1923'] = e_seq[e_seq.index > '12-01-1923'] * 1e12 lab = ['Price index (marks or converted to marks)', - '1/cents per mark (or reichsmark converted to mark)'] + 'Marks per US cent(or reichsmark converted to mark)'] # Create plot fig, ax = plt.subplots(dpi=200)