<jupyter_start><jupyter_text>I’m not sure if I should contact the author directly, but you may be interested to note that some of the data sets provided in the Dougherty site contain errors and omissions that make it difficult to replicated some of the exercises provided in the book.<jupyter_code>#!pip install wbdata    
import wbdata
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.formula.api as smf


import matplotlib.pyplot as plt
 
#set up the countries I want
countries = ["CL","UY","HU"]
 
#set up the indicator I want (just build up the dict if you want more than one)
indicators = {'NY.GNP.PCAP.CD':'GNI per Capita'}
 
#grab indicators above for countires above and load into data frame
df = wbdata.get_dataframe(indicators, country=countries, convert_date=False)

#df is "pivoted", pandas' unstack fucntion helps reshape it into something plottable
dfu = df.unstack(level=0)

# a simple matplotlib plot with legend, labels and a title
dfu.plot(); 
plt.legend(loc='best'); 
plt.title("GNI Per Capita ($USD, Atlas Method)"); 
plt.xlabel('Date'); plt.ylabel('GNI Per Capita ($USD, Atlas Method');

# Get data directly from Dougherty without any need to download first
# This is Data on GDP Growth and Employment

#df = pd.read_excel('http://global.oup.com/uk/orc/busecon/economics/dougherty5e/student/datasets/oecd/excel/oecd.xls'
df = pd.read_stata('http://global.oup.com/uk/orc/busecon/economics/dougherty5e/student/datasets/oecd/stata/oecd.dta')

#
# Check to see if countries are the same
df['country']
df
# We want to replicate Exercise 1.5 pg. 102
mod = smf.ols('EMPLOY ~ GDP', data=df)
res = mod.fit()
print(res.summary())
# This is not helpful, so we'll need to get out own data to replicated list of countries for
# 2002 -2007
# We can at least get list of countris from the previous data and use it in our world bank search
countries = list(df['country'])
countries
# We also 
data_date = datetime.datetime(2010, 1, 1), datetime.datetime(2011, 1, 1) 
df = wbdata.get_data("IC.BUS.EASE.XQ", country=countries, data_date=data_date)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10180780209324453, 'fraction_numerical': 0.013320647002854425, 'mean_word_length': 4.907303370786517, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '650956', 'license': 'MIT', 'n_tokens_mistral': 745, 'n_tokens_neox': 687, 'n_words': 253, 'path': 'KernelSmoothingPopulations.ipynb', 'repo_name': 'pjakobsen/pydough', 'size': '2102'}