Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ErikHogenbirk/343536f5f4a4304fa5caecb65e1b5596 to your computer and use it in GitHub Desktop.
Save ErikHogenbirk/343536f5f4a4304fa5caecb65e1b5596 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/indexes/base.py in get_loc(self, key, method, tolerance)
1944 try:
-> 1945 return self._engine.get_loc(key)
1946 except KeyError:
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4154)()
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4018)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322)()
KeyError: 'alt_s2_interaction_z'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-61-0c8e4f0c9c6b> in <module>()
2 all_energy = sciencerun0.AllEnergy()
3 #all_energy.lichen_list = [_lichen for i, _lichen in enumerate(all_energy.lichen_list) if i != 7]
----> 4 df = all_energy.process(df)
5
6 low_energy = sciencerun0.LowEnergy()
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/lax-0.1.0-py3.4.egg/lax/lichen.py in process(self, df)
79 for lichen in self.lichen_list:
80 # Heavy lifting here
---> 81 df = lichen.process(df)
82
83 cut_name = lichen.name()
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/lax-0.1.0-py3.4.egg/lax/lichen.py in process(self, df)
25 def process(self, df):
26 df = self.pre(df)
---> 27 df = self._process(df)
28 df = self.post(df)
29
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/lax-0.1.0-py3.4.egg/lax/lichens/sciencerun0.py in _process(self, df)
217 s2width = S2Width
218
--> 219 alt_rel_width = df['s2_range_50p_area'] / s2width.s2_width_model(df['alt_s2_interaction_z'])
220 alt_interaction_passes = alt_rel_width < s2width.relative_s2_width_bounds(df.s2.values, kind='high')
221 alt_interaction_passes &= alt_rel_width > s2width.relative_s2_width_bounds(df.s2.values, kind='low')
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/core/frame.py in __getitem__(self, key)
1995 return self._getitem_multilevel(key)
1996 else:
-> 1997 return self._getitem_column(key)
1998
1999 def _getitem_column(self, key):
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/core/frame.py in _getitem_column(self, key)
2002 # get column
2003 if self.columns.is_unique:
-> 2004 return self._get_item_cache(key)
2005
2006 # duplicate columns & possible reduce dimensionality
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
1348 res = cache.get(item)
1349 if res is None:
-> 1350 values = self._data.get(item)
1351 res = self._box_item_values(item, values)
1352 cache[item] = res
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/core/internals.py in get(self, item, fastpath)
3288
3289 if not isnull(item):
-> 3290 loc = self.items.get_loc(item)
3291 else:
3292 indexer = np.arange(len(self.items))[isnull(self.items)]
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/pandas/indexes/base.py in get_loc(self, key, method, tolerance)
1945 return self._engine.get_loc(key)
1946 except KeyError:
-> 1947 return self._engine.get_loc(self._maybe_cast_indexer(key))
1948
1949 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4154)()
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4018)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368)()
pandas/hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322)()
KeyError: 'alt_s2_interaction_z'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment