Detail: Frame: Selector

Overview: Frame: Selector

Frame.bloc[key]
bloc
>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.bloc[f > 5]
<Series>
<Index>
('p', 'a') 10
('p', 'b') 8
('r', 'b') 8
('r', 'c') 9
('s', 'c') 12
<object>   <int64>
Frame.drop[key]
drop
InterfaceSelectTrio.__getitem__(key)[source]

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.drop['c']
<Frame: x>
<Index>    a       b       <<U1>
<Index>
p          10      8
q          -2      -3
r          0       8
s          0       0
<<U1>      <int64> <int64>
>>> f.drop['b':]
<Frame: x>
<Index>    a       <<U1>
<Index>
p          10
q          -2
r          0
s          0
<<U1>      <int64>
>>> f.drop[['a', 'c']]
<Frame: x>
<Index>    b       <<U1>
<Index>
p          8
q          -3
r          8
s          0
<<U1>      <int64>
Frame.drop.iloc[key]
Frame.drop
InterfaceSelectTrio.iloc

Integer-position based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.drop.iloc[1]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.drop.iloc[1:]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
<<U1>      <int64> <int64> <int64>
>>> f.drop.iloc[[0, 2]]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
q          -2      -3      0
s          0       0       12
<<U1>      <int64> <int64> <int64>
Frame.drop.loc[key]
Frame.drop
InterfaceSelectTrio.loc

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.drop.loc['r']
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.drop.loc['r':]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
<<U1>      <int64> <int64> <int64>
>>> f.drop.loc[['p', 's']]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
q          -2      -3      0
r          0       8       9
<<U1>      <int64> <int64> <int64>
Frame.mask[key]
mask
InterfaceSelectTrio.__getitem__(key)[source]

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.mask['c']
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  False  True
q       False  False  True
r       False  False  True
s       False  False  True
<<U1>   <bool> <bool> <bool>
>>> f.mask['b':]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  True   True
q       False  True   True
r       False  True   True
s       False  True   True
<<U1>   <bool> <bool> <bool>
>>> f.mask[['a', 'c']]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       True   False  True
q       True   False  True
r       True   False  True
s       True   False  True
<<U1>   <bool> <bool> <bool>
Frame.mask.iloc[key]
Frame.mask
InterfaceSelectTrio.iloc

Integer-position based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.mask.iloc[1]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  False  False
q       True   True   True
r       False  False  False
s       False  False  False
<<U1>   <bool> <bool> <bool>
>>> f.mask.iloc[1:]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  False  False
q       True   True   True
r       True   True   True
s       True   True   True
<<U1>   <bool> <bool> <bool>
>>> f.mask.iloc[[0, 2]]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       True   True   True
q       False  False  False
r       True   True   True
s       False  False  False
<<U1>   <bool> <bool> <bool>
Frame.mask.loc[key]
Frame.mask
InterfaceSelectTrio.loc

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.mask.loc['r']
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  False  False
q       False  False  False
r       True   True   True
s       False  False  False
<<U1>   <bool> <bool> <bool>
>>> f.mask.loc['r':]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       False  False  False
q       False  False  False
r       True   True   True
s       True   True   True
<<U1>   <bool> <bool> <bool>
>>> f.mask.loc[['p', 's']]
<Frame>
<Index> a      b      c      <<U1>
<Index>
p       True   True   True
q       False  False  False
r       False  False  False
s       True   True   True
<<U1>   <bool> <bool> <bool>
Frame.masked_array[key]
masked_array
InterfaceSelectTrio.__getitem__(key)[source]

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.masked_array['c']
[[10 8 --]
 [-2 -3 --]
 [0 8 --]
 [0 0 --]]
>>> f.masked_array['b':]
[[10 -- --]
 [-2 -- --]
 [0 -- --]
 [0 -- --]]
>>> f.masked_array[['a', 'c']]
[[-- 8 --]
 [-- -3 --]
 [-- 8 --]
 [-- 0 --]]
Frame.masked_array.iloc[key]
Frame.masked_array
InterfaceSelectTrio.iloc

Integer-position based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.masked_array.iloc[1]
[[10 8 1]
 [-- -- --]
 [0 8 9]
 [0 0 12]]
>>> f.masked_array.iloc[1:]
[[10 8 1]
 [-- -- --]
 [-- -- --]
 [-- -- --]]
>>> f.masked_array.iloc[[0, 2]]
[[-- -- --]
 [-2 -3 0]
 [-- -- --]
 [0 0 12]]
Frame.masked_array.loc[key]
Frame.masked_array
InterfaceSelectTrio.loc

Label-based selection.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.masked_array.loc['r']
[[10 8 1]
 [-2 -3 0]
 [-- -- --]
 [0 0 12]]
>>> f.masked_array.loc['r':]
[[10 8 1]
 [-2 -3 0]
 [-- -- --]
 [-- -- --]]
>>> f.masked_array.loc[['p', 's']]
[[-- -- --]
 [-2 -3 0]
 [0 8 9]
 [-- -- --]]
Frame[key]()
Frame.__getitem__ = <function Frame.__getitem__>[source]
>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f['b']
<Series: b>
<Index>
p           8
q           -3
r           8
s           0
<<U1>       <int64>
>>> f['b':]
<Frame: x>
<Index>    b       c       <<U1>
<Index>
p          8       1
q          -3      0
r          8       9
s          0       12
<<U1>      <int64> <int64>
>>> f[['a', 'c']]
<Frame: x>
<Index>    a       c       <<U1>
<Index>
p          10      1
q          -2      0
r          0       9
s          0       12
<<U1>      <int64> <int64>
Frame.iloc[key]
iloc
>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.iloc[2]
<Series: r>
<Index>
a           0
b           8
c           9
<<U1>       <int64>
>>> f.iloc[2:]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.iloc[[0, 3]]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
s          0       0       12
<<U1>      <int64> <int64> <int64>
Frame.loc[key]
loc
>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
q          -2      -3      0
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.loc['r']
<Series: r>
<Index>
a           0
b           8
c           9
<<U1>       <int64>
>>> f.loc['r':]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
r          0       8       9
s          0       0       12
<<U1>      <int64> <int64> <int64>
>>> f.loc[['p', 's']]
<Frame: x>
<Index>    a       b       c       <<U1>
<Index>
p          10      8       1
s          0       0       12
<<U1>      <int64> <int64> <int64>

Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic