Skip to content

Commit 703a8c1

Browse files
authored
Merge branch 'main' into french_rev
2 parents 9febfab + 2b7dd96 commit 703a8c1

25 files changed

+1034
-817
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
commit-message:
11+
prefix: ⬆️
12+
schedule:
13+
interval: weekly

.github/workflows/cache.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v4
1212
- name: Setup Anaconda
13-
uses: conda-incubator/setup-miniconda@v2
13+
uses: conda-incubator/setup-miniconda@v3
1414
with:
1515
auto-update-conda: true
1616
auto-activate-base: true
@@ -39,13 +39,13 @@ jobs:
3939
run: |
4040
jb build lectures --path-output ./ -W --keep-going
4141
- name: Upload Execution Reports (HTML)
42-
uses: actions/upload-artifact@v2
42+
uses: actions/upload-artifact@v4
4343
if: failure()
4444
with:
4545
name: execution-reports
4646
path: _build/html/reports
4747
- name: Upload "_build" folder (cache)
48-
uses: actions/upload-artifact@v2
48+
uses: actions/upload-artifact@v4
4949
with:
5050
name: build-cache
5151
path: _build

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
shell: bash -l {0}
3939
run: pip list
4040
- name: Download "build" folder (cache)
41-
uses: dawidd6/action-download-artifact@v2
41+
uses: dawidd6/action-download-artifact@v6
4242
with:
4343
workflow: cache.yml
4444
branch: main
@@ -78,7 +78,7 @@ jobs:
7878
name: execution-reports
7979
path: _build/html/reports
8080
- name: Preview Deploy to Netlify
81-
uses: nwtgck/actions-netlify@v2
81+
uses: nwtgck/actions-netlify@v3.0
8282
with:
8383
publish-dir: '_build/html/'
8484
production-branch: main

.github/workflows/collab.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
shell: bash -l {0}
2121
run: pip list
2222
- name: Download "build" folder (cache)
23-
uses: dawidd6/action-download-artifact@v3
23+
uses: dawidd6/action-download-artifact@v6
2424
with:
2525
workflow: cache.yml
2626
branch: main
@@ -43,7 +43,7 @@ jobs:
4343
name: execution-reports
4444
path: _build/html/reports
4545
- name: Preview Deploy to Netlify
46-
uses: nwtgck/actions-netlify@v2
46+
uses: nwtgck/actions-netlify@v3.0
4747
with:
4848
publish-dir: '_build/html/'
4949
production-branch: main

.github/workflows/linkcheck.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
python-version: ["3.11"]
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020
- name: Setup Anaconda
21-
uses: conda-incubator/setup-miniconda@v2
21+
uses: conda-incubator/setup-miniconda@v3
2222
with:
2323
auto-update-conda: true
2424
auto-activate-base: true
@@ -27,7 +27,7 @@ jobs:
2727
environment-file: environment.yml
2828
activate-environment: quantecon
2929
- name: Download "build" folder (cache)
30-
uses: dawidd6/action-download-artifact@v2
30+
uses: dawidd6/action-download-artifact@v6
3131
with:
3232
workflow: cache.yml
3333
branch: main
@@ -37,7 +37,7 @@ jobs:
3737
shell: bash -l {0}
3838
run: jb build lectures --path-output=./ --builder=custom --custom-builder=linkcheck
3939
- name: Upload Link Checker Reports
40-
uses: actions/upload-artifact@v2
40+
uses: actions/upload-artifact@v4
4141
if: failure()
4242
with:
4343
name: linkcheck-reports

.github/workflows/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313
- name: Setup Anaconda
14-
uses: conda-incubator/setup-miniconda@v2
14+
uses: conda-incubator/setup-miniconda@v3
1515
with:
1616
auto-update-conda: true
1717
auto-activate-base: true
@@ -39,7 +39,7 @@ jobs:
3939
shell: bash -l {0}
4040
run: pip list
4141
- name: Download "build" folder (cache)
42-
uses: dawidd6/action-download-artifact@v2
42+
uses: dawidd6/action-download-artifact@v6
4343
with:
4444
workflow: cache.yml
4545
branch: main
@@ -73,7 +73,7 @@ jobs:
7373
rm -r _build/.doctrees
7474
jb build lectures --path-output ./
7575
- name: Deploy to Netlify
76-
uses: nwtgck/actions-netlify@v1.1
76+
uses: nwtgck/actions-netlify@v3.0
7777
with:
7878
publish-dir: '_build/html/'
7979
production-branch: main
@@ -83,13 +83,13 @@ jobs:
8383
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
8484
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
8585
- name: Deploy website to gh-pages
86-
uses: peaceiris/actions-gh-pages@v3
86+
uses: peaceiris/actions-gh-pages@v4
8787
with:
8888
github_token: ${{ secrets.GITHUB_TOKEN }}
8989
publish_dir: _build/html/
9090
cname: intro.quantecon.org
9191
- name: Upload "_build" folder (cache)
92-
uses: actions/upload-artifact@v2
92+
uses: actions/upload-artifact@v4
9393
with:
9494
name: build-publish
9595
path: _build

lectures/_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ sphinx:
7575
colab_url : https://colab.research.google.com
7676
thebe : false # Add a thebe button to pages (requires the repository to run on Binder)
7777
intersphinx_mapping:
78+
intermediate:
79+
- https://python.quantecon.org/
80+
- null
7881
pyprog:
7982
- https://python-programming.quantecon.org/
8083
- null
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "258b4bc9-2964-470a-8010-05c2162f5e05",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"Requirement already satisfied: wbgapi in /Users/longye/anaconda3/lib/python3.10/site-packages (1.0.12)\n",
14+
"Requirement already satisfied: plotly in /Users/longye/anaconda3/lib/python3.10/site-packages (5.22.0)\n",
15+
"Requirement already satisfied: requests in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (2.31.0)\n",
16+
"Requirement already satisfied: tabulate in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (0.9.0)\n",
17+
"Requirement already satisfied: PyYAML in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (6.0)\n",
18+
"Requirement already satisfied: tenacity>=6.2.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from plotly) (8.4.1)\n",
19+
"Requirement already satisfied: packaging in /Users/longye/anaconda3/lib/python3.10/site-packages (from plotly) (23.1)\n",
20+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (1.26.16)\n",
21+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (2.0.4)\n",
22+
"Requirement already satisfied: idna<4,>=2.5 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (3.4)\n",
23+
"Requirement already satisfied: certifi>=2017.4.17 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (2024.6.2)\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"!pip install wbgapi plotly\n",
29+
"\n",
30+
"import pandas as pd\n",
31+
"import numpy as np\n",
32+
"import matplotlib.pyplot as plt\n",
33+
"import random as rd\n",
34+
"import wbgapi as wb\n",
35+
"import plotly.express as px\n",
36+
"\n",
37+
"url = 'https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/SCF_plus/SCF_plus_mini.csv'\n",
38+
"df = pd.read_csv(url)\n",
39+
"df_income_wealth = df.dropna()"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": 4,
45+
"id": "9630a07a-fce5-474e-92af-104e67e82be5",
46+
"metadata": {},
47+
"outputs": [
48+
{
49+
"name": "stdout",
50+
"output_type": "stream",
51+
"text": [
52+
"Requirement already satisfied: quantecon in /Users/longye/anaconda3/lib/python3.10/site-packages (0.7.1)\n",
53+
"Requirement already satisfied: requests in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (2.31.0)\n",
54+
"Requirement already satisfied: numpy>=1.17.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.26.3)\n",
55+
"Requirement already satisfied: numba>=0.49.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (0.59.1)\n",
56+
"Requirement already satisfied: sympy in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.12)\n",
57+
"Requirement already satisfied: scipy>=1.5.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.12.0)\n",
58+
"Requirement already satisfied: llvmlite<0.43,>=0.42.0dev0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from numba>=0.49.0->quantecon) (0.42.0)\n",
59+
"Requirement already satisfied: certifi>=2017.4.17 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (2024.6.2)\n",
60+
"Requirement already satisfied: idna<4,>=2.5 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (3.4)\n",
61+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (2.0.4)\n",
62+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (1.26.16)\n",
63+
"Requirement already satisfied: mpmath>=0.19 in /Users/longye/anaconda3/lib/python3.10/site-packages (from sympy->quantecon) (1.3.0)\n"
64+
]
65+
}
66+
],
67+
"source": [
68+
"!pip install quantecon\n",
69+
"import quantecon as qe\n",
70+
"\n",
71+
"varlist = ['n_wealth', # net wealth \n",
72+
" 't_income', # total income\n",
73+
" 'l_income'] # labor income\n",
74+
"\n",
75+
"df = df_income_wealth\n",
76+
"years = df.year.unique()\n",
77+
"\n",
78+
"# create lists to store Gini for each inequality measure\n",
79+
"results = {}\n",
80+
"\n",
81+
"for var in varlist:\n",
82+
" # create lists to store Gini\n",
83+
" gini_yr = []\n",
84+
" for year in years:\n",
85+
" # repeat the observations according to their weights\n",
86+
" counts = list(round(df[df['year'] == year]['weights'] ))\n",
87+
" y = df[df['year'] == year][var].repeat(counts)\n",
88+
" y = np.asarray(y)\n",
89+
" \n",
90+
" rd.shuffle(y) # shuffle the sequence\n",
91+
" \n",
92+
" # calculate and store Gini\n",
93+
" gini = qe.gini_coefficient(y)\n",
94+
" gini_yr.append(gini)\n",
95+
" \n",
96+
" results[var] = gini_yr\n",
97+
"\n",
98+
"# Convert to DataFrame\n",
99+
"results = pd.DataFrame(results, index=years)\n",
100+
"results.to_csv(\"usa-gini-nwealth-tincome-lincome.csv\", index_label='year')"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"id": "d59e876b-2f77-4fa7-b79a-8e455ad82d43",
107+
"metadata": {},
108+
"outputs": [],
109+
"source": []
110+
}
111+
],
112+
"metadata": {
113+
"kernelspec": {
114+
"display_name": "Python 3 (ipykernel)",
115+
"language": "python",
116+
"name": "python3"
117+
},
118+
"language_info": {
119+
"codemirror_mode": {
120+
"name": "ipython",
121+
"version": 3
122+
},
123+
"file_extension": ".py",
124+
"mimetype": "text/x-python",
125+
"name": "python",
126+
"nbconvert_exporter": "python",
127+
"pygments_lexer": "ipython3",
128+
"version": "3.10.12"
129+
}
130+
},
131+
"nbformat": 4,
132+
"nbformat_minor": 5
133+
}
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
year,n_wealth,t_income,l_income
2-
1950,0.8257332034366338,0.44248654139458626,0.5342948198773412
3-
1953,0.8059487586599329,0.4264544060935945,0.5158978980963702
4-
1956,0.8121790488050616,0.44426942873399283,0.5349293526208142
5-
1959,0.795206874163792,0.43749348077061573,0.5213985948309416
6-
1962,0.8086945076579359,0.4435843103853645,0.5345127915054341
7-
1965,0.7904149225687935,0.43763715466663444,0.7487860020887753
8-
1968,0.7982885066993497,0.4208620794438902,0.5242396427381545
9-
1971,0.7911574835420259,0.4233344246090255,0.5576454812313466
10-
1977,0.7571418922185215,0.46187678800902543,0.5704448110072049
11-
1983,0.7494335400643013,0.439345618464469,0.5662220844385915
12-
1989,0.7715705301674302,0.5115249581654197,0.601399568747142
13-
1992,0.7508126614055308,0.4740650672076798,0.5983592657979563
14-
1995,0.7569492388110265,0.48965523558400603,0.5969779516716903
15-
1998,0.7603291991801185,0.49117441585168614,0.5774462841723305
16-
2001,0.7816118750507056,0.5239092994681135,0.6042739644967272
17-
2004,0.7700355469522361,0.4884350383903255,0.5981432201792727
18-
2007,0.7821413776486978,0.5197156312086187,0.626345219575322
19-
2010,0.8250825295193438,0.5195972120145615,0.6453653328291903
20-
2013,0.8227698931835303,0.531400174984336,0.6498682917772644
21-
2016,0.8342975903562234,0.5541400068900825,0.6706846793375284
2+
1950,0.8257332034366366,0.44248654139458743,0.534294819877344
3+
1953,0.805948758659935,0.4264544060935942,0.5158978980963682
4+
1956,0.8121790488050612,0.44426942873399367,0.5349293526208106
5+
1959,0.7952068741637912,0.43749348077061534,0.5213985948309414
6+
1962,0.8086945076579386,0.44358431038536356,0.5345127915054446
7+
1965,0.7904149225687949,0.4376371546666344,0.7487860020887701
8+
1968,0.7982885066993503,0.4208620794438885,0.5242396427381534
9+
1971,0.7911574835420282,0.4233344246090255,0.5576454812313462
10+
1977,0.7571418922185215,0.46187678800902554,0.57044481100722
11+
1983,0.749433540064301,0.4393456184644682,0.5662220844385925
12+
1989,0.7715705301674285,0.5115249581654115,0.6013995687471289
13+
1992,0.7508126614055305,0.4740650672076754,0.5983592657979544
14+
1995,0.7569492388110274,0.4896552355840001,0.5969779516717039
15+
1998,0.7603291991801172,0.49117441585168525,0.5774462841723346
16+
2001,0.781611875050703,0.523909299468113,0.6042739644967232
17+
2004,0.7700355469522372,0.48843503839032354,0.5981432201792916
18+
2007,0.782141377648698,0.5197156312086207,0.6263452195753227
19+
2010,0.825082529519342,0.5195972120145641,0.6453653328291843
20+
2013,0.8227698931835299,0.5314001749843426,0.6498682917772886
21+
2016,0.8342975903562537,0.55414000689009,0.6706846793375292

lectures/_static/lecture_specific/short_path/Graph-networkx2.ipynb

Lines changed: 0 additions & 279 deletions
This file was deleted.

lectures/_static/lecture_specific/short_path/figures.ipynb

Lines changed: 229 additions & 0 deletions
Large diffs are not rendered by default.
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)