Detail: Frame: Dictionary-Like

Overview: Frame: Dictionary-Like

Frame.__contains__(value)[source]

Inclusion of value in column labels.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> f.__contains__('a')
True
Frame.__iter__()[source]

Iterator of column labels, same as Frame.keys().

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> tuple(f.__iter__())
('a', 'b', 'c')
Frame.__reversed__()[source]

Returns a reverse iterator on the frame’s columns.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> tuple(f.__reversed__())
('c', 'b', 'a')
Frame.get(key, default=None)[source]

Return the value found at the columns key, else the default if the key is not found. This method is implemented to complete the dictionary-like interface.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> f.get('a')
<Series: a>
<Index>
0           10
1           2
2           8
3           3
<int64>     <int64>
>>> f.get('z', -1)
-1
Frame.items()[source]

Iterator of pairs of column label and corresponding column Series.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> tuple(f.items())
(('a', <Series: a>
<Index>
0           10
1           2
2           8
3           3
<int64>     <int64>), ('b', <Series: b>
<Index>
0           False
1           True
2           True
3           False
<int64>     <bool>), ('c', <Series: c>
<Index>
0           1517-01-01
1           1517-04-01
2           1517-12-31
3           1517-06-30
<int64>     <datetime64[D]>))
Frame.keys()[source]

Iterator of column labels.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> f.keys()
<Index>
a
b
c
<<U1>
Frame.values

A 2D NumPy array of all values in the Frame. As this is a single array, heterogenous columnar types might be coerced to a compatible type.

>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> f.values
[[10 False datetime.date(1517, 1, 1)]
 [2 True datetime.date(1517, 4, 1)]
 [8 True datetime.date(1517, 12, 31)]
 [3 False datetime.date(1517, 6, 30)]]

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