Detail: Yarn: Dictionary-Like
Overview: Yarn: Dictionary-Like
- Yarn.__contains__(value)[source]
Inclusion of value in index labels.
- Returns:
bool
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.__contains__('a') RuntimeError('Invalid key length for a; must be length 2.')
- Yarn.__iter__()[source]
Iterator of index labels, same as
static_frame.Series.keys
.- Returns:
Iterator[Hashasble]
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> tuple(y.__iter__()) (('i', 'x'), ('i', 'y'), ('j', 'v'), ('j', 'w'))
- Yarn.__reversed__()[source]
Returns a reverse iterator on the
Yarn
index.- Returns:
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> tuple(y.__reversed__()) (('j', 'w'), ('j', 'v'), ('i', 'y'), ('i', 'x'))
- Yarn.get(key, default=None)[source]
Return the value found at the index key, else the default if the key is not found.
- Returns:
Any
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.get('a') RuntimeError('Invalid key length for a; must be length 2.') >>> y.get('z', -1) RuntimeError('Invalid key length for z; must be length 2.')
- Yarn.items()[source]
Iterator of pairs of
Yarn
label and containedFrame
.>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> tuple(y.items()) ((('i', 'x'), <Frame: x> <Index> a b <<U1> <Index> p 0 1 q 2 3 r 4 5 <<U1> <int64> <int64>), (('i', 'y'), <Frame: y> <Index> c d <<U1> <Index> p False True q False True r False True <<U1> <bool> <bool>), (('j', 'v'), <Frame: v> <Index> a b <<U1> <Index> p 40 41 q 42 43 r 44 45 <<U1> <int64> <int64>), (('j', 'w'), <Frame: w> <Index> c d <<U1> <Index> p False True q True False r True True <<U1> <bool> <bool>))
- Yarn.keys()[source]
Iterator of index labels.
- Returns:
Iterator[Hashable]
>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.keys() <IndexHierarchy> i x i y j v j w <<U1> <<U1>
- Yarn.values
A 1D object array of all
Frame
contained in all containedBus
.>>> y = sf.Yarn.from_buses((sf.Bus.from_frames((sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x'), sf.Frame((np.arange(6).reshape(3,2) % 2).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='y')), name='i'), sf.Bus.from_frames((sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'), sf.Frame((np.arange(6).reshape(3,2) % 3).astype(bool), index=('p', 'q', 'r'), columns=('c', 'd'), name='w')), name='j')), retain_labels=True) >>> y <Yarn> <IndexHierarchy> i x Frame i y Frame j v Frame j w Frame <<U1> <<U1> <object> >>> y.values [<Frame: x> <Index> a b <<U1> <Index> p 0 1 q 2 3 r 4 5 <<U1> <int64> <int64> <Frame: y> <Index> c d <<U1> <Index> p False True q False True r False True <<U1> <bool> <bool> <Frame: v> <Index> a b <<U1> <Index> p 40 41 q 42 43 r 44 45 <<U1> <int64> <int64> <Frame: w> <Index> c d <<U1> <Index> p False True q True False r True True <<U1> <bool> <bool> ]
Yarn: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic