Detail: Yarn: Selector

Overview: Yarn: Selector

Yarn.drop[key]
drop

Interface for dropping elements from Yarn.

InterfaceSelectTrio.__getitem__(key)[source]

Label-based selection.

>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.drop['x']
<Yarn>
<Index>
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.drop['v':]
<Yarn>
<Index>
x       Frame
y       Frame
<<U1>   <object>
>>> y.drop[['w', 'y']]
<Yarn>
<Index>
x       Frame
v       Frame
<<U1>   <object>
Yarn.drop.iloc[key]
Yarn.drop

Interface for dropping elements from Yarn.

InterfaceSelectTrio.iloc

Integer-position based selection.

>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.drop.iloc[1]
<Yarn>
<Index>
x       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.drop.iloc[1:]
<Yarn>
<Index>
x       Frame
<<U1>   <object>
>>> y.drop.iloc[[0, 3]]
<Yarn>
<Index>
y       Frame
v       Frame
<<U1>   <object>
Yarn.drop.loc[key]
Yarn.drop

Interface for dropping elements from Yarn.

InterfaceSelectTrio.loc

Label-based selection.

>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.drop.loc['w']
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
<<U1>   <object>
>>> y.drop.loc['v':]
<Yarn>
<Index>
x       Frame
y       Frame
<<U1>   <object>
>>> y.drop.loc[['v', 'x']]
<Yarn>
<Index>
y       Frame
w       Frame
<<U1>   <object>
Yarn[key]()
Yarn.__getitem__ = <function Yarn.__getitem__>[source]
>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y['w']
<Frame: w>
<Index>    c      d      <<U1>
<Index>
p          False  True
q          True   False
r          True   True
<<U1>      <bool> <bool>
>>> y['v':]
<Yarn>
<Index>
v       Frame
w       Frame
<<U1>   <object>
>>> y[['v', 'x']]
<Yarn>
<Index>
v       Frame
x       Frame
<<U1>   <object>
Yarn.iloc[key]
iloc
>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.iloc[1]
<Frame: y>
<Index>    c      d      <<U1>
<Index>
p          False  True
q          False  True
r          False  True
<<U1>      <bool> <bool>
>>> y.iloc[1:]
<Yarn>
<Index>
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.iloc[[0, 3]]
<Yarn>
<Index>
x       Frame
w       Frame
<<U1>   <object>
Yarn.loc[key]
loc
>>> b1 = 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')
>>> b2 = 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')
>>> y = sf.Yarn.from_buses((b1, b2), retain_labels=False)
>>> y
<Yarn>
<Index>
x       Frame
y       Frame
v       Frame
w       Frame
<<U1>   <object>
>>> y.loc['w']
<Frame: w>
<Index>    c      d      <<U1>
<Index>
p          False  True
q          True   False
r          True   True
<<U1>      <bool> <bool>
>>> y.loc['v':]
<Yarn>
<Index>
v       Frame
w       Frame
<<U1>   <object>
>>> y.loc[['v', 'x']]
<Yarn>
<Index>
v       Frame
x       Frame
<<U1>   <object>

Yarn: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Accessor Hashlib | Accessor Type Clinic