@@ -21,13 +21,15 @@ The `xlrd` package is used by `pandas` to perform operations on Excel files.
21
21
22
22
``` {code-cell} ipython3
23
23
:tags: [hide-output]
24
+
24
25
!pip install xlrd
25
26
```
26
27
27
28
<!-- Check for pandas>=2.1.4 for Google Collab Compat -->
28
29
29
30
``` {code-cell} ipython3
30
31
:tags: [hide-cell]
32
+
31
33
from importlib.metadata import version
32
34
from packaging.version import Version
33
35
@@ -100,16 +102,16 @@ mystnb:
100
102
caption: Long run time series of the price level
101
103
name: lrpl
102
104
---
103
- df_fig5_bef1914 = df_fig5[df_fig5.index <= 1915 ]
105
+ df_fig5_befe1914 = df_fig5[df_fig5.index <= 1914 ]
104
106
105
107
# Create plot
106
108
cols = ['UK', 'US', 'France', 'Castile']
107
109
108
- fig, ax = plt.subplots(dpi=200 )
110
+ fig, ax = plt.subplots(figsize=(10,6) )
109
111
110
112
for col in cols:
111
- ax.plot(df_fig5_bef1914 .index,
112
- df_fig5_bef1914 [col], label=col, lw=2)
113
+ ax.plot(df_fig5_befe1914 .index,
114
+ df_fig5_befe1914 [col], label=col, lw=2)
113
115
114
116
ax.legend()
115
117
ax.set_ylabel('Index 1913 = 100')
@@ -327,11 +329,6 @@ def pr_plot(p_seq, index, ax):
327
329
# Calculate the difference of log p_seq
328
330
log_diff_p = np.diff(np.log(p_seq))
329
331
330
- # Graph for the difference of log p_seq
331
- ax.scatter(index[1:], log_diff_p,
332
- label='Monthly inflation rate',
333
- color='tab:grey')
334
-
335
332
# Calculate and plot moving average
336
333
diff_smooth = pd.DataFrame(log_diff_p).rolling(3, center=True).mean()
337
334
ax.plot(index[1:], diff_smooth, label='Moving average (3 period)', alpha=0.5, lw=2)
@@ -345,7 +342,7 @@ def pr_plot(p_seq, index, ax):
345
342
for label in ax.get_xticklabels():
346
343
label.set_rotation(45)
347
344
348
- ax.legend(loc='upper left' )
345
+ ax.legend()
349
346
350
347
return ax
351
348
```
@@ -419,7 +416,7 @@ p_seq = df_aus['Retail price index, 52 commodities']
419
416
e_seq = df_aus['Exchange Rate']
420
417
421
418
lab = ['Retail price index',
422
- '1/cents per Austrian Krone (Crown) ']
419
+ 'Austrian Krones (Crowns) per US cent ']
423
420
424
421
# Create plot
425
422
fig, ax = plt.subplots(dpi=200)
@@ -463,12 +460,11 @@ mystnb:
463
460
caption: Price index and exchange rate (Hungary)
464
461
name: pi_xrate_hungary
465
462
---
466
- m_seq = df_hun['Notes in circulation']
467
463
p_seq = df_hun['Hungarian index of prices']
468
464
e_seq = 1 / df_hun['Cents per crown in New York']
469
465
470
466
lab = ['Hungarian index of prices',
471
- '1/cents per Hungarian Korona (Crown) ']
467
+ 'Hungarian Koronas (Crowns) per US cent ']
472
468
473
469
# Create plot
474
470
fig, ax = plt.subplots(dpi=200)
@@ -537,7 +533,7 @@ e_seq[e_seq.index > '05-01-1924'] = np.nan
537
533
538
534
``` {code-cell} ipython3
539
535
lab = ['Wholesale price index',
540
- '1/cents per polish mark ']
536
+ 'Polish marks per US cent ']
541
537
542
538
# Create plot
543
539
fig, ax = plt.subplots(dpi=200)
@@ -579,7 +575,7 @@ p_seq = df_deu['Price index (on basis of marks before July 1924,'
579
575
e_seq = 1/df_deu['Cents per mark']
580
576
581
577
lab = ['Price index',
582
- '1/cents per mark ']
578
+ 'Marks per US cent ']
583
579
584
580
# Create plot
585
581
fig, ax = plt.subplots(dpi=200)
@@ -606,7 +602,7 @@ e_seq[e_seq.index > '12-01-1923'] = e_seq[e_seq.index
606
602
> '12-01-1923'] * 1e12
607
603
608
604
lab = ['Price index (marks or converted to marks)',
609
- '1/cents per mark (or reichsmark converted to mark)']
605
+ 'Marks per US cent (or reichsmark converted to mark)']
610
606
611
607
# Create plot
612
608
fig, ax = plt.subplots(dpi=200)
0 commit comments