---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-135-eb4e309aaacf> in <module>()
2 #%timeit make_plot(DB_PATH, HOST, resample='30Min')
3 get_ipython().magic(u"timeit make_plot(DB_PATH, HOST, resample='6min')")
----> 4 get_ipython().magic(u"timeit make_plot(DB_PATH, HOST, resample='6min', immediate=True)")
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2305 magic_name, _, magic_arg_s = arg_s.partition(' ')
2306 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2307 return self.run_line_magic(magic_name, magic_arg_s)
2308
2309 #-------------------------------------------------------------------------
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2226 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2227 with self.builtin_trap:
-> 2228 result = fn(*args,**kwargs)
2229 return result
2230
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in timeit(self, line, cell)
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in timeit(self, line, cell)
1034 number = 1
1035 for _ in range(1, 10):
-> 1036 time_number = timer.timeit(number)
1037 worst_tuning = max(worst_tuning, time_number / number)
1038 if time_number >= 0.2:
/home/reichler/anaconda/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in timeit(self, number)
130 gc.disable()
131 try:
--> 132 timing = self.inner(it, self.timer)
133 finally:
134 if gcold:
<magic-timeit> in inner(_it, _timer)
<ipython-input-133-88c51396d626> in make_plot(db_path, host, sw, **kwargs)
3 sw = Stopwatch('Make Plot')
4
----> 5 df, sw = read_df(db_path, host, sw=sw, **kwargs)
6 plot(df, sw=sw)
7
<ipython-input-131-430965ae9f3a> in read_df(db_path, host, sw, from_id, deduplicate, table, immediate, **kwargs)
29 sw.event('De-duplication')
30
---> 31 pivoted, _ = prepare_df(df, sw, **kwargs)
32
33 return pivoted, sw
<ipython-input-132-87d0c1220ee2> in prepare_df(df, sw, resample)
3 sw = Stopwatch('Pivot and adjust data frame')
4
----> 5 pivoted = df.pivot(index = 'timestamp', columns='type', values='value') .tz_localize('UTC').tz_convert('Europe/Amsterdam')
6 sw.event('pivot table')
7
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in pivot(self, index, columns, values)
3507 """
3508 from pandas.core.reshape import pivot
-> 3509 return pivot(self, index=index, columns=columns, values=values)
3510
3511 def stack(self, level=-1, dropna=True):
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/reshape.pyc in pivot(self, index, columns, values)
324 else:
325 indexed = Series(self[values].values,
--> 326 index=MultiIndex.from_arrays([self[index],
327 self[columns]]))
328 return indexed.unstack(columns)
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in __getitem__(self, key)
1795 return self._getitem_multilevel(key)
1796 else:
-> 1797 return self._getitem_column(key)
1798
1799 def _getitem_column(self, key):
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in _getitem_column(self, key)
1802 # get column
1803 if self.columns.is_unique:
-> 1804 return self._get_item_cache(key)
1805
1806 # duplicate columns & possible reduce dimensionaility
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in _get_item_cache(self, item)
1082 res = cache.get(item)
1083 if res is None:
-> 1084 values = self._data.get(item)
1085 res = self._box_item_values(item, values)
1086 cache[item] = res
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/internals.pyc in get(self, item, fastpath)
2849
2850 if not isnull(item):
-> 2851 loc = self.items.get_loc(item)
2852 else:
2853 indexer = np.arange(len(self.items))[isnull(self.items)]
/home/reichler/anaconda/lib/python2.7/site-packages/pandas/core/index.pyc in get_loc(self, key, method)
1570 """
1571 if method is None:
-> 1572 return self._engine.get_loc(_values_from_object(key))
1573
1574 indexer = self.get_indexer([key], method=method)
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:3824)()
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:3704)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12280)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12231)()
KeyError: 'timestamp'