Skip to content

Commit 3653c62

Browse files
committed
remove skip-execution code as it is not compatible with google collab
1 parent f22b53d commit 3653c62

File tree

1 file changed

+4
-43
lines changed

1 file changed

+4
-43
lines changed

lectures/inequality.md

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The following code block imports a subset of the dataset `SCF_plus` for 2016,
247247
which is derived from the [Survey of Consumer Finances](https://en.wikipedia.org/wiki/Survey_of_Consumer_Finances) (SCF).
248248

249249
```{code-cell} ipython3
250-
url = 'https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/SCF_plus/SCF_plus_mini.csv'
250+
url = 'https://github.com/QuantEcon/high_dim_data/raw/main/SCF_plus/SCF_plus_mini.csv'
251251
df = pd.read_csv(url)
252252
df_income_wealth = df.dropna()
253253
```
@@ -619,46 +619,11 @@ We will use US data from the {ref}`Survey of Consumer Finances<data:survey-consu
619619
df_income_wealth.year.describe()
620620
```
621621

622-
This code can be used to compute this information over the full dataset.
622+
{download}`This notebook <_static/lecture_specific/inequality/data.ipynb>` can be used to compute this information over the full dataset.
623623

624624
```{code-cell} ipython3
625-
:tags: [skip-execution, hide-input, hide-output]
626-
627-
!pip install quantecon
628-
import quantecon as qe
629-
630-
varlist = ['n_wealth', # net wealth
631-
't_income', # total income
632-
'l_income'] # labor income
633-
634-
df = df_income_wealth
635-
636-
# create lists to store Gini for each inequality measure
637-
results = {}
638-
639-
for var in varlist:
640-
# create lists to store Gini
641-
gini_yr = []
642-
for year in years:
643-
# repeat the observations according to their weights
644-
counts = list(round(df[df['year'] == year]['weights'] ))
645-
y = df[df['year'] == year][var].repeat(counts)
646-
y = np.asarray(y)
647-
648-
rd.shuffle(y) # shuffle the sequence
649-
650-
# calculate and store Gini
651-
gini = qe.gini_coefficient(y)
652-
gini_yr.append(gini)
653-
654-
results[var] = gini_yr
655-
656-
# Convert to DataFrame
657-
results = pd.DataFrame(results, index=years)
658-
```
659-
660-
```{code-cell} ipython3
661-
ginis = results
625+
data_url = 'https://github.com/QuantEcon/lecture-python-intro/raw/main/lectures/_static/lecture_specific/inequality/usa-gini-nwealth-tincome-lincome.csv'
626+
ginis = pd.read_csv(data_url, index_col='year')
662627
ginis.head(n=5)
663628
```
664629

@@ -685,10 +650,6 @@ One possibility is that this change is mainly driven by technology.
685650

686651
However, we will see below that not all advanced economies experienced similar growth of inequality.
687652

688-
689-
690-
691-
692653
### Cross-country comparisons of income inequality
693654

694655
Earlier in this lecture we used `wbgapi` to get Gini data across many countries

0 commit comments

Comments
 (0)