def webuse(data, baseurl='http://www.stata-press.com/data/r11/', as_df=True):
 from statsmodels.iolib import genfromdta
 url = urljoin(baseurl, (data + '.dta'))
 dta = urlopen(url)
 dta = BytesIO(dta.read())
 if as_df:
  return DataFrame.from_records(genfromdta(dta))
 else:
  return genfromdta(dta)

def webuse ( data , baseurl = 'http://www.stata-press.com/data/r11/' , as_df = True ) : from statsmodels . iolib import genfromdta url = urljoin ( baseurl , ( data + '.dta' ) ) dta = urlopen ( url ) dta = BytesIO ( dta . read ( ) ) if as_df : return DataFrame . from_records ( genfromdta ( dta ) ) else : return genfromdta ( dta )
download and return an example dataset from stata .