Skip to content

Commit c1261eb

Browse files
authored
Merge branch 'main' into update-theme
2 parents 1c712ff + 3e07d3b commit c1261eb

File tree

3 files changed

+37
-46
lines changed

3 files changed

+37
-46
lines changed

lectures/french_rev.md

+21-27
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.2
7+
jupytext_version: 1.16.7
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -90,13 +90,11 @@ These graphs show that during the 18th century
9090
but were substantially less than government expenditures during wars
9191
* In France, even in peace time, tax revenues were substantially less than government expenditures
9292

93-
94-
9593
```{code-cell} ipython3
9694
---
9795
mystnb:
9896
figure:
99-
caption: "Military Spending in Britain and France"
97+
caption: Military Spending in Britain and France
10098
name: fr_fig4
10199
---
102100
# Read the data from Excel file
@@ -139,16 +137,15 @@ during those four wars.
139137

140138
A remarkable aspect of figure {numref}`fr_fig4` is that despite having a population less than half of France's, Britain was able to finance military expenses of about the same amounts as France's.
141139

142-
This testifies to Britain's having created state institutions that could sustain high tax collections, government spending , and government borrowing. See {cite}`north1989`.
140+
This testifies to Britain's having created state institutions that could sustain high tax collections, government spending , and government borrowing. See {cite}`north1989`.
143141

144142
```{code-cell} ipython3
145143
---
146144
mystnb:
147145
figure:
148-
caption: "Government Expenditures and Tax Revenues in Britain"
146+
caption: Government Expenditures and Tax Revenues in Britain
149147
name: fr_fig2
150148
---
151-
152149
# Read the data from Excel file
153150
data2 = pd.read_excel(dette_url, sheet_name='Militspe', usecols='M:X',
154151
skiprows=7, nrows=102, header=None)
@@ -178,7 +175,6 @@ plt.tight_layout()
178175
plt.show()
179176
```
180177

181-
182178
Figures {numref}`fr_fig2` and {numref}`fr_fig3` summarize British and French government fiscal policies during the century before the start of the French Revolution in 1789.
183179

184180

@@ -224,10 +220,9 @@ Next we'll plot data on debt service costs as fractions of government revenues i
224220
---
225221
mystnb:
226222
figure:
227-
caption: "Ratio of debt service to taxes, Britain and France"
223+
caption: Ratio of debt service to taxes, Britain and France
228224
name: fr_fig1
229225
---
230-
231226
# Read the data from the Excel file
232227
data1 = pd.read_excel(dette_url, sheet_name='Debt',
233228
usecols='R:S', skiprows=5, nrows=99, header=None)
@@ -265,7 +260,6 @@ Figure {numref}`fr_fig1` shows that interest payments on government debt (i.e.,
265260

266261
But as we'll see in our next graph, on the eve of the French Revolution in 1788, the fiscal *law of gravity* that worked so well in Britain did not working very well in France.
267262

268-
269263
```{code-cell} ipython3
270264
# Read the data from the Excel file
271265
data1 = pd.read_excel(fig_3_url, sheet_name='Sheet1',
@@ -278,7 +272,7 @@ data1.replace(0, np.nan, inplace=True)
278272
---
279273
mystnb:
280274
figure:
281-
caption: "Government Spending and Tax Revenues in France"
275+
caption: Government Spending and Tax Revenues in France
282276
name: fr_fig3
283277
---
284278
# Plot the data
@@ -430,7 +424,7 @@ The next figure shows this
430424
---
431425
mystnb:
432426
figure:
433-
caption: "Index of real per capital revenues, France"
427+
caption: Index of real per capital revenues, France
434428
name: fr_fig5
435429
---
436430
# Read data from Excel file
@@ -466,7 +460,7 @@ amounts during the period form 1789 to 1799.
466460
---
467461
mystnb:
468462
figure:
469-
caption: "Spending (blue) and Revenues (orange), (real values)"
463+
caption: Spending (blue) and Revenues (orange), (real values)
470464
name: fr_fig11
471465
---
472466
# Read data from Excel file
@@ -512,7 +506,7 @@ of goods and services, including military goods and soldiers' pay.
512506
---
513507
mystnb:
514508
figure:
515-
caption: "Revenues raised by printing paper money notes"
509+
caption: Revenues raised by printing paper money notes
516510
name: fr_fig24
517511
---
518512
# Read data from Excel file
@@ -521,15 +515,15 @@ data12 = pd.read_excel(assignat_url, sheet_name='seignor',
521515
522516
# Create a figure and plot the data
523517
plt.figure()
524-
plt.plot(pd.date_range(start='1790', periods=len(data12), freq='M'),
518+
plt.plot(pd.date_range(start='1790', periods=len(data12), freq='ME'),
525519
data12, linewidth=0.8)
526520
527521
plt.gca().spines['top'].set_visible(False)
528522
plt.gca().spines['right'].set_visible(False)
529523
530524
plt.axhline(y=472.42/12, color='r', linestyle=':')
531525
plt.xticks(ticks=pd.date_range(start='1790',
532-
end='1796', freq='AS'), labels=range(1790, 1797))
526+
end='1796', freq='YS'), labels=range(1790, 1797))
533527
plt.xlim(pd.Timestamp('1791'),
534528
pd.Timestamp('1796-02') + pd.DateOffset(months=2))
535529
plt.ylabel('millions of livres', fontsize=12)
@@ -575,7 +569,7 @@ Note that we use a log scale because the price level rose so much.
575569
---
576570
mystnb:
577571
figure:
578-
caption: "Price Level and Price of Gold (log scale)"
572+
caption: Price Level and Price of Gold (log scale)
579573
name: fr_fig9
580574
---
581575
# Read the data from Excel file
@@ -644,7 +638,7 @@ nearly met in one of these episodes than in the other two.
644638
---
645639
mystnb:
646640
figure:
647-
caption: "Real balances of assignats (in gold and goods)"
641+
caption: Real balances of assignats (in gold and goods)
648642
name: fr_fig8
649643
---
650644
# Read the data from Excel file
@@ -655,7 +649,7 @@ data7a = pd.read_excel(assignat_url, sheet_name='Data',
655649
656650
# Create the figure and plot
657651
plt.figure()
658-
h = plt.plot(pd.date_range(start='1789-11-01', periods=len(data7), freq='M'),
652+
h = plt.plot(pd.date_range(start='1789-11-01', periods=len(data7), freq='ME'),
659653
(data7a.values * [1, 1]) * data7.values, linewidth=1.)
660654
plt.setp(h[1], linestyle='--', color='red')
661655
@@ -736,7 +730,7 @@ a3_rev, b3_rev = fit(infl[44:63], bal[44:63])
736730
---
737731
mystnb:
738732
figure:
739-
caption: "Inflation and Real Balances"
733+
caption: Inflation and Real Balances
740734
name: fr_fig104
741735
---
742736
plt.figure()
@@ -791,7 +785,7 @@ a3_rev, b3_rev = fit(infl[44:63], bal[44:63])
791785
---
792786
mystnb:
793787
figure:
794-
caption: "Inflation and Real Balances"
788+
caption: Inflation and Real Balances
795789
name: fr_fig104b
796790
---
797791
plt.figure()
@@ -822,7 +816,7 @@ line.
822816
---
823817
mystnb:
824818
figure:
825-
caption: "Inflation and Real Balances"
819+
caption: Inflation and Real Balances
826820
name: fr_fig104c
827821
---
828822
plt.figure()
@@ -867,7 +861,7 @@ line.
867861
---
868862
mystnb:
869863
figure:
870-
caption: "Inflation and Real Balances"
864+
caption: Inflation and Real Balances
871865
name: fr_fig104d
872866
---
873867
plt.figure()
@@ -912,7 +906,7 @@ Cagan {cite}`Cagan`.
912906
---
913907
mystnb:
914908
figure:
915-
caption: "Inflation and Real Balances"
909+
caption: Inflation and Real Balances
916910
name: fr_fig104e
917911
---
918912
plt.figure()
@@ -946,7 +940,7 @@ period of the hyperinflation.
946940
---
947941
mystnb:
948942
figure:
949-
caption: "Inflation and Real Balances"
943+
caption: Inflation and Real Balances
950944
name: fr_fig104f
951945
---
952946
plt.figure()
@@ -993,4 +987,4 @@ This lecture sets the stage for studying theories of inflation and the govern
993987

994988
A *monetarist theory of the price level* is described in this quantecon lecture {doc}`cagan_ree`.
995989

996-
That lecture sets the stage for these quantecon lectures {doc}`money_inflation` and {doc}`unpleasant`.
990+
That lecture sets the stage for these quantecon lectures {doc}`money_inflation` and {doc}`unpleasant`.

lectures/greek_square.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Chapter 24 of {cite}`russell2004history` about early Greek mathematics and astro
2020
fascinating passage:
2121

2222
```{epigraph}
23-
The square root of 2, which was the first irrational to be discovered, was known to the early Pythagoreans, and ingenious methods of approximating to its value were discovered. The best was as follows: Form two columns of numbers, which we will call the $a$'s and the $b$'s; each starts with a $1$. The next $a$, at each stage, is formed by adding the last $a$ and the $b$ already obtained; the next $b$ is formed by adding twice the previous $a$ to the previous $b$. The first 6 pairs so obtained are $(1,1), (2,3), (5,7), (12,17), (29,41), (70,99)$. In each pair, $2 a - b$ is $1$ or $-1$. Thus $b/a$ is nearly the square root of two, and at each fresh step it gets nearer. For instance, the reader may satisy himself that the square of $99/70$ is very nearly equal to $2$.
23+
The square root of 2, which was the first irrational to be discovered, was known to the early Pythagoreans, and ingenious methods of approximating to its value were discovered. The best was as follows: Form two columns of numbers, which we will call the $a$'s and the $b$'s; each starts with a $1$. The next $a$, at each stage, is formed by adding the last $a$ and the $b$ already obtained; the next $b$ is formed by adding twice the previous $a$ to the previous $b$. The first 6 pairs so obtained are $(1,1), (2,3), (5,7), (12,17), (29,41), (70,99)$. In each pair, $2 a^2 - b^2$ is $1$ or $-1$. Thus $b/a$ is nearly the square root of two, and at each fresh step it gets nearer. For instance, the reader may satisy himself that the square of $99/70$ is very nearly equal to $2$.
2424
```
2525

2626
This lecture drills down and studies this ancient method for computing square roots by using some of the matrix algebra that we've learned in earlier quantecon lectures.

lectures/heavy_tails.md

+15-18
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.1
7+
jupytext_version: 1.16.7
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -19,7 +19,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
1919
```{code-cell} ipython3
2020
:tags: [hide-output]
2121
22-
!pip install --upgrade yfinance pandas_datareader
22+
!pip install --upgrade yfinance wbgapi
2323
```
2424

2525
We use the following imports.
@@ -31,7 +31,7 @@ import yfinance as yf
3131
import pandas as pd
3232
import statsmodels.api as sm
3333
34-
from pandas_datareader import wb
34+
import wbgapi as wb
3535
from scipy.stats import norm, cauchy
3636
from pandas.plotting import register_matplotlib_converters
3737
register_matplotlib_converters()
@@ -790,24 +790,21 @@ def empirical_ccdf(data,
790790
:tags: [hide-input]
791791
792792
def extract_wb(varlist=['NY.GDP.MKTP.CD'],
793-
c='all_countries',
793+
c='all',
794794
s=1900,
795795
e=2021,
796796
varnames=None):
797-
if c == "all_countries":
798-
# Keep countries only (no aggregated regions)
799-
countries = wb.get_countries()
800-
countries_name = countries[countries['region'] != 'Aggregates']['name'].values
801-
c = "all"
802797
803-
df = wb.download(indicator=varlist, country=c, start=s, end=e).stack().unstack(0).reset_index()
804-
df = df.drop(['level_1'], axis=1).transpose()
798+
df = wb.data.DataFrame(varlist, economy=c, time=range(s, e+1, 1), skipAggs=True)
799+
df.index.name = 'country'
800+
805801
if varnames is not None:
806-
df.columns = varnames
807-
df = df[1:]
802+
df.columns = variable_names
803+
804+
cntry_mapper = pd.DataFrame(wb.economy.info().items)[['id','value']].set_index('id').to_dict()['value']
805+
df.index = df.index.map(lambda x: cntry_mapper[x]) #map iso3c to name values
808806
809-
df1 =df[df.index.isin(countries_name)]
810-
return df1
807+
return df
811808
```
812809

813810
### Firm size
@@ -914,9 +911,9 @@ variable_code = ['NY.GDP.MKTP.CD', 'NY.GDP.PCAP.CD']
914911
variable_names = ['GDP', 'GDP per capita']
915912
916913
df_gdp1 = extract_wb(varlist=variable_code,
917-
c="all_countries",
918-
s="2021",
919-
e="2021",
914+
c="all",
915+
s=2021,
916+
e=2021,
920917
varnames=variable_names)
921918
df_gdp1.dropna(inplace=True)
922919
```

0 commit comments

Comments
 (0)