Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot create a Pattern with selectors containing different numbers of levels #52

Open
lebedov opened this issue Sep 7, 2015 · 0 comments
Labels

Comments

@lebedov
Copy link
Member

lebedov commented Sep 7, 2015

With c5b56bd, attempting to run the following results in an exception:

import nk.pattern
pat = nk.pattern.Pattern('/a/b','/x/y/z')

Error trace:

/home/lev/Work/projects/bionet/python/nk1/neurokernel/pattern.pyc in __init__(self, *selectors, **kwargs)
   1078         # consecutively:
   1079         for i, s in enumerate(selectors):
-> 1080             self.interface[s, 'interface'] = i
   1081 
   1082         # Create a MultiIndex that can store mappings between identifiers in the

/home/lev/Work/projects/bionet/python/nk1/neurokernel/pattern.pyc in __setitem__(self, key, value)
    181                                       len(self.index.shape))
    182         for k, v in data.iteritems():
--> 183             self.data[k].ix[s] = v
    184 
    185     @property

/home/lev/Work/miniconda/envs/NK1/lib/python2.7/site-packages/pandas/core/indexing.pyc in __setitem__(self, key, value)
    112 
    113     def __setitem__(self, key, value):
--> 114         indexer = self._get_setitem_indexer(key)
    115         self._setitem_with_indexer(indexer, value)
    116 

/home/lev/Work/miniconda/envs/NK1/lib/python2.7/site-packages/pandas/core/indexing.pyc in _get_setitem_indexer(self, key)
    107 
    108         try:
--> 109             return self._convert_to_indexer(key, is_setter=True)
    110         except TypeError:
    111             raise IndexingError(key)

/home/lev/Work/miniconda/envs/NK1/lib/python2.7/site-packages/pandas/core/indexing.pyc in _convert_to_indexer(self, obj, axis, is_setter)
   1110                 mask = check == -1
   1111                 if mask.any():
-> 1112                     raise KeyError('%s not in index' % objarr[mask])
   1113 
   1114                 return _values_from_object(indexer)

KeyError: "[('a', 'b')] not in index"
@lebedov lebedov added the bug label Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant