Define the query terms you want to investigate.

In [9]:
QUERY_TERMS = ['dollar', 'bitcoin']

And just press re-run.

In [10]:
import pandas as pd
import json
import re
import urllib2

%pylab inline

QUERY = 'http://www.google.com/trends/fetchComponent?q=%s&cid=TIMESERIES_GRAPH_0&export=3' % ",".join(QUERY_TERMS)

data = urllib2.urlopen(QUERY).read()

# We need to do some data cleaning: remove Javascript header+footer, and translate new Date(....,..,..) into YYYY-MM-DD.
header = """// Data table response\ngoogle.visualization.Query.setResponse("""
data = data[len(header):-2]
data = re.sub('new Date\((\d+),(\d+),(\d+)\)', (lambda m: '"%s-%02d-%02d"' % (m.group(1).strip(), 1+int(m.group(2)), int(m.group(3)))), data)

timeseries = json.loads(data)
Populating the interactive namespace from numpy and matplotlib
In [11]:
columns = [k['label'] for k in timeseries['table']['cols']]
rows = map(lambda x: [k['v'] for k in x['c']], timeseries['table']['rows'])
df = pd.DataFrame(rows, columns=columns)
df.set_index('Date', inplace=True)
df.plot(figsize=(16, 8))
Out[11]:
<matplotlib.axes.AxesSubplot at 0x10f242610>