We will dive deep into information available from NSF.

We will have to download some files first and then we will be able to do some analysis.


In [4]:
import requests

In [13]:
def get_nsf_awards(start_year, end_year):
    for year in range(start_year, end_year):
        payload = {'DownloadFileName':year,'All':'true'}
        url = 'http://www.nsf.gov/awardsearch/download?'
        r = requests.get(url, params=payload)
        return r

r = get_nsf_awards(1959, 2014)

In [20]:
#not working properly yet
import zipfile, StringIO
r = get_nsf_awards(1959, 2014)
z = zipfile.ZipFile(StringIO.StringIO(r.content))
z.extractall()
z.open()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-20-402851eaef33> in <module>()
      3 z = zipfile.ZipFile(StringIO.StringIO(r.content))
      4 z.extractall()
----> 5 z.open()

TypeError: open() takes at least 2 arguments (1 given)