Skip to content

Instantly share code, notes, and snippets.

@pzwang
Created February 1, 2013 04:11
Show Gist options
  • Save pzwang/ce09394e928890825263 to your computer and use it in GitHub Desktop.
Save pzwang/ce09394e928890825263 to your computer and use it in GitHub Desktop.
In [7]: class Custom(Record):
...: max = int32
...: min = int32
...: @derived
...: def mid(self):
...: return (self.min + self.max)/2
...:
In [8]: Custom
Out[8]: __main__.Custom
In [9]: type(Custom)
Out[9]: blaze.datashape.record.DeclMeta
In [10]: print Custom
<class '__main__.Custom'>
In [11]: a = Table([(5,10), (12,24), (20,24)], Custom)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-5f74679e3d45> in <module>()
----> 1 a = Table([(5,10), (12,24), (20,24)], Custom)
/Users/pwang/continuum/src/blaze-core/blaze/table.pyc in __init__(self, data, dshape, metadata, layout, params)
451 self.data = CTableSource(data, dshape=dshape, params=params)
452 # Pull the labels from the datashape
--> 453 self._axes = self._datashape[-1].names
454 else:
455 raise ValueError
TypeError: 'DeclMeta' object does not support indexing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment