Detail: Frame: Iterator
- Frame.iter_array(*, axis)
- iter_array
Iterator of
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
>>> 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> >>> tuple(f.iter_array()) (array([10, -2, 0, 0]), array([ 8, -3, 8, 0]), array([ 1, 0, 9, 12]))
- Frame.iter_array(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_array
Iterator of
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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.iter_array().apply(lambda v: v.sum()) <Series> <Index> a 8 b 13 c 22 <<U1> <int64>
- Frame.iter_array(*, axis).apply_iter(func)
- iter_array
Iterator of
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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> >>> tuple(f.iter_array().apply_iter(lambda v: v.sum())) (8, 13, 22)
- Frame.iter_array(*, axis).apply_iter_items(func)
- iter_array
Iterator of
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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> >>> tuple(f.iter_array().apply_iter_items(lambda v: v.sum())) (('a', 8), ('b', 13), ('c', 22))
- Frame.iter_array(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_array
Iterator of
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> 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.iter_array().apply_pool(lambda v: v.sum(), use_threads=True) <Series> <Index> a 8 b 13 c 22 <<U1> <int64>
- Frame.iter_array_items(*, axis)
- iter_array_items
Iterator of pairs of label,
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
>>> 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> >>> tuple(f.iter_array_items()) (('a', array([10, -2, 0, 0])), ('b', array([ 8, -3, 8, 0])), ('c', array([ 1, 0, 9, 12])))
- Frame.iter_array_items(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_array_items
Iterator of pairs of label,
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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.iter_array_items().apply(lambda k, v: v.sum() if k != 'b' else -1) <Series> <Index> a 8 b -1 c 22 <<U1> <int64>
- Frame.iter_array_items(*, axis).apply_iter(func)
- iter_array_items
Iterator of pairs of label,
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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> >>> tuple(f.iter_array_items().apply_iter(lambda k, v: v.sum() if k != 'b' else -1)) (8, -1, 22)
- Frame.iter_array_items(*, axis).apply_iter_items(func)
- iter_array_items
Iterator of pairs of label,
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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> >>> tuple(f.iter_array_items().apply_iter_items(lambda k, v: v.sum() if k != 'b' else -1)) (('a', 8), ('b', -1), ('c', 22))
- Frame.iter_array_items(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_array_items
Iterator of pairs of label,
np.array
, where arrays are drawn from columns (axis=0) or rows (axis=1)
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> 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.iter_array_items().apply_pool(lambda pair: pair[1].sum() if pair[0] != 'b' else -1, use_threads=True) <Series> <Index> a 8 b -1 c 22 <<U1> <int64>
- Frame.iter_element(*, axis)
- iter_element
Iterator of elements, ordered by row then column.
>>> 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> >>> tuple(f.iter_element()) (10, 8, 1, -2, -3, 0, 0, 8, 9, 0, 0, 12)
- Frame.iter_element(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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.iter_element().apply(lambda e: e > 5) <Frame> <Index> a b c <<U1> <Index> p True True False q False False False r False True True s False False True <<U1> <bool> <bool> <bool>
- Frame.iter_element(*, axis).apply_iter(func)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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> >>> tuple(f.iter_element().apply_iter(lambda e: e > 10)) (False, False, False, False, False, False, False, False, False, False, False, True)
- Frame.iter_element(*, axis).apply_iter_items(func)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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> >>> tuple(f.iter_element().apply_iter_items(lambda e: e > 10)) ((('p', 'a'), False), (('p', 'b'), False), (('p', 'c'), False), (('q', 'a'), False), (('q', 'b'), False), (('q', 'c'), False), (('r', 'a'), False), (('r', 'b'), False), (('r', 'c'), False), (('s', 'a'), False), (('s', 'b'), False), (('s', 'c'), True))
- Frame.iter_element(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> 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.iter_element().apply_pool(lambda e: e > 5, use_threads=True) <Frame> <Index> a b c <<U1> <Index> p True True False q False False False r False True True s False False True <<U1> <bool> <bool> <bool>
- Frame.iter_element(*, axis).map_all(mapping, *, dtype, name, index_constructor)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_all(mapping, *, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> f.iter_element().map_all({0: 200, 1: -1, 2: 45}) <Frame> <Index> a b c <<U1> <Index> p -1 45 -1 q 45 -1 200 r 200 45 45 s 200 200 -1 <<U1> <int64> <int64> <int64>
- Frame.iter_element(*, axis).map_all_iter(mapping)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_all_iter(mapping)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_all_iter({0: 200, 1: -1, 2: 45})) (-1, 45, -1, 45, -1, 200, 200, 45, 45, 200, 200, -1)
- Frame.iter_element(*, axis).map_all_iter_items(mapping)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_all_iter_items(mapping)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_all_iter_items({0: 200, 1: -1, 2: 45})) ((('p', 'a'), -1), (('p', 'b'), 45), (('p', 'c'), -1), (('q', 'a'), 45), (('q', 'b'), -1), (('q', 'c'), 200), (('r', 'a'), 200), (('r', 'b'), 45), (('r', 'c'), 45), (('s', 'a'), 200), (('s', 'b'), 200), (('s', 'c'), -1))
- Frame.iter_element(*, axis).map_any(mapping, *, dtype, name, index_constructor)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_any(mapping, *, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> f.iter_element().map_any({1: -1, 2: 45}) <Frame> <Index> a b c <<U1> <Index> p -1 45 -1 q 45 -1 0 r 0 45 45 s 0 0 -1 <<U1> <int64> <int64> <int64>
- Frame.iter_element(*, axis).map_any_iter(mapping)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_any_iter(mapping)[source]
Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_any_iter({1: -1, 2: 45})) (-1, 45, -1, 45, -1, 0, 0, 45, 45, 0, 0, -1)
- Frame.iter_element(*, axis).map_any_iter_items(mapping)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_any_iter_items(mapping)[source]
Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_any_iter_items({1: -1, 2: 45})) ((('p', 'a'), -1), (('p', 'b'), 45), (('p', 'c'), -1), (('q', 'a'), 45), (('q', 'b'), -1), (('q', 'c'), 0), (('r', 'a'), 0), (('r', 'b'), 45), (('r', 'c'), 45), (('s', 'a'), 0), (('s', 'b'), 0), (('s', 'c'), -1))
- Frame.iter_element(*, axis).map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_fill(mapping, *, fill_value=nan, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. Returns a new container.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> f.iter_element().map_fill({1: -1, 2: 45}, fill_value=np.nan) <Frame> <Index> a b c <<U1> <Index> p -1.0 45.0 -1.0 q 45.0 -1.0 nan r nan 45.0 45.0 s nan nan -1.0 <<U1> <float64> <float64> <float64>
- Frame.iter_element(*, axis).map_fill_iter(mapping, *, fill_value)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_fill_iter(mapping, *, fill_value=nan)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. A generator of resulting values.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_fill_iter({1: -1, 2: 45}, fill_value=np.nan)) (-1, 45, -1, 45, -1, nan, nan, 45, 45, nan, nan, -1)
- Frame.iter_element(*, axis).map_fill_iter_items(mapping, *, fill_value)
- iter_element
Iterator of elements, ordered by row then column.
- IterNodeDelegateMapable.map_fill_iter_items(mapping, *, fill_value=nan)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. A generator of resulting key, value pairs.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element().map_fill_iter_items({1: -1, 2: 45}, fill_value=np.nan)) ((('p', 'a'), -1), (('p', 'b'), 45), (('p', 'c'), -1), (('q', 'a'), 45), (('q', 'b'), -1), (('q', 'c'), nan), (('r', 'a'), nan), (('r', 'b'), 45), (('r', 'c'), 45), (('s', 'a'), nan), (('s', 'b'), nan), (('s', 'c'), -1))
- Frame.iter_element_items(*, axis)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
>>> 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> >>> tuple(f.iter_element_items()) ((('p', 'a'), 10), (('p', 'b'), 8), (('p', 'c'), 1), (('q', 'a'), -2), (('q', 'b'), -3), (('q', 'c'), 0), (('r', 'a'), 0), (('r', 'b'), 8), (('r', 'c'), 9), (('s', 'a'), 0), (('s', 'b'), 0), (('s', 'c'), 12))
- Frame.iter_element_items(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> f.iter_element_items().apply(lambda k, v: v > 1 if k != ('q', 'b') else 'x') <Frame> <Index> a b c <<U1> <Index> p False True False q True x False r False True True s False False False <<U1> <bool> <object> <bool>
- Frame.iter_element_items(*, axis).apply_iter(func)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element_items().apply_iter(lambda k, v: v > 1 if k != ('q', 'b') else 'x')) (False, True, False, True, 'x', False, False, True, True, False, False, False)
- Frame.iter_element_items(*, axis).apply_iter_items(func)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> tuple(f.iter_element_items().apply_iter_items(lambda k, v: v > 1 if k != ('q', 'b') else 'x')) ((('p', 'a'), False), (('p', 'b'), True), (('p', 'c'), False), (('q', 'a'), True), (('q', 'b'), 'x'), (('q', 'c'), False), (('r', 'a'), False), (('r', 'b'), True), (('r', 'c'), True), (('s', 'a'), False), (('s', 'b'), False), (('s', 'c'), False))
- Frame.iter_element_items(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> def func(pair): return pair[1] > 0 and pair[0] == ('q', 'b') >>> f = sf.Frame.from_fields(((1, 2, 0, 0), (2, 1, 2, 0), (1, 0, 2, 1)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> p 1 2 1 q 2 1 0 r 0 2 2 s 0 0 1 <<U1> <int64> <int64> <int64> >>> f.iter_element_items().apply_pool(func, use_threads=True) <Frame> <Index> a b c <<U1> <Index> p False False False q False True False r False False False s False False False <<U1> <bool> <bool> <bool>
- Frame.iter_element_items(*, axis).map_all(mapping, *, dtype, name, index_constructor)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_all(mapping, *, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. Returns a new container.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> f.iter_element_items().map_all({(('p', 'a'), 2): 200, (('p', 'b'), 3): -1, (('q', 'a'), 9): 45, (('q', 'b'), 8): 1}) <Frame> <Index> a b <<U1> <Index> p 200 -1 q 45 1 <<U1> <int64> <int64>
- Frame.iter_element_items(*, axis).map_all_iter(mapping)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_all_iter(mapping)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting values.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_all_iter({(('p', 'a'), 2): 200, (('p', 'b'), 3): -1, (('q', 'a'), 9): 45, (('q', 'b'), 8): 1})) (200, -1, 45, 1)
- Frame.iter_element_items(*, axis).map_all_iter_items(mapping)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_all_iter_items(mapping)[source]
Apply a mapping; for values not in the mapping, an Exception is raised. A generator of resulting key, value pairs.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_all_iter_items({(('p', 'a'), 2): 200, (('p', 'b'), 3): -1, (('q', 'a'), 9): 45, (('q', 'b'), 8): 1})) ((('p', 'a'), 200), (('p', 'b'), -1), (('q', 'a'), 45), (('q', 'b'), 1))
- Frame.iter_element_items(*, axis).map_any(mapping, *, dtype, name, index_constructor)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_any(mapping, *, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, the value is returned. Returns a new container.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> f.iter_element_items().map_any({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1}) <Frame> <Index> a b <<U1> <Index> p 200 3 q 9 1 <<U1> <int64> <int64>
- Frame.iter_element_items(*, axis).map_any_iter(mapping)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_any_iter(mapping)[source]
Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting values.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_any_iter({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1})) (200, 3, 9, 1)
- Frame.iter_element_items(*, axis).map_any_iter_items(mapping)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_any_iter_items(mapping)[source]
Apply a mapping; for values not in the mapping, the value is returned. A generator of resulting key, value pairs.
- Parameters:
mapping – A mapping type, such as a dictionary or Series.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_any_iter_items({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1})) ((('p', 'a'), 200), (('p', 'b'), 3), (('q', 'a'), 9), (('q', 'b'), 1))
- Frame.iter_element_items(*, axis).map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_fill(mapping, *, fill_value=nan, dtype=None, name=None, index_constructor=None)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. Returns a new container.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> f.iter_element_items().map_fill({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1}, fill_value=-1) <Frame> <Index> a b <<U1> <Index> p 200 -1 q -1 1 <<U1> <int64> <int64>
- Frame.iter_element_items(*, axis).map_fill_iter(mapping, *, fill_value)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_fill_iter(mapping, *, fill_value=nan)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. A generator of resulting values.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_fill_iter({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1}, fill_value=-1)) (200, -1, -1, 1)
- Frame.iter_element_items(*, axis).map_fill_iter_items(mapping, *, fill_value)
- iter_element_items
Iterator of pairs of label, element, where labels are pairs of index, columns labels, ordered by row then column.
- IterNodeDelegateMapable.map_fill_iter_items(mapping, *, fill_value=nan)[source]
Apply a mapping; for values not in the mapping, the
fill_value
is returned. A generator of resulting key, value pairs.- Parameters:
mapping – A mapping type, such as a dictionary or Series.
fill_value – Value to be returned if the values is not a key in the mapping.
>>> f = sf.Frame.from_fields(((2, 9), (3, 8)), columns=('a', 'b'), index=('p', 'q'), name='x') >>> f <Frame: x> <Index> a b <<U1> <Index> p 2 3 q 9 8 <<U1> <int64> <int64> >>> tuple(f.iter_element_items().map_fill_iter_items({(('p', 'a'), 2): 200, (('q', 'b'), 8): 1}, fill_value=-1)) ((('p', 'a'), 200), (('p', 'b'), -1), (('q', 'a'), -1), (('q', 'b'), 1))
- Frame.iter_group(key, *, axis, drop)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c')) (<Frame> <Index> a b c <<U1> <Index> 0 11 0 0 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> 1 4 8 1 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_group(key, *, axis, drop).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').apply(lambda f: f['b'].sum()) <Series> <Index: c> 0 3 1 16 <int64> <int64>
- Frame.iter_group(key, *, axis, drop).apply_iter(func)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').apply_iter(lambda f: f['b'].sum())) (3, 16)
- Frame.iter_group(key, *, axis, drop).apply_iter_items(func)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').apply_iter_items(lambda f: f['b'].sum())) ((0, 3), (1, 16))
- Frame.iter_group(key, *, axis, drop).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> def func(f): return f['b'].sum() >>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').apply_pool(func, use_threads=True) <Series> <Index: c> 0 3 1 16 <int64> <int64>
- Frame.iter_group(key, *, axis, drop).reduce.from_func(func, *, fill_value).keys()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_func(lambda f: f.iloc[1:]).keys()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_func(func, *, fill_value).__iter__()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_func(lambda f: f.iloc[1:]).__iter__()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_func(func, *, fill_value).items()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_func(lambda f: f.iloc[1:]).items()) ((0, <Frame> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>), (1, <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>))
- Frame.iter_group(key, *, axis, drop).reduce.from_func(func, *, fill_value).values()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_func(lambda f: f.iloc[1:]).values()) (<Frame> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_group(key, *, axis, drop).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').reduce.from_func(lambda f: f.iloc[1:]).to_frame() <Frame> <Index> a b c <<U1> <Index> 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).keys()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_map_func(np.min).keys()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_map_func(np.min).__iter__()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).items()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_map_func(np.min).items()) ((0, <Series: 0> <Index> a 10 b 0 c 0 <<U1> <int64>), (1, <Series: 1> <Index> a 2 b 8 c 1 <<U1> <int64>))
- Frame.iter_group(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).values()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_map_func(np.min).values()) (<Series: 0> <Index> a 10 b 0 c 0 <<U1> <int64>, <Series: 1> <Index> a 2 b 8 c 1 <<U1> <int64>)
- Frame.iter_group(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').reduce.from_map_func(np.min).to_frame() <Frame> <Index> a b c <<U1> <Index> 0 10 0 0 1 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((0, <Series: 0> <Index> b 0 a 11 <<U1> <int64>), (1, <Series: 1> <Index> b 8 a 4 <<U1> <int64>))
- Frame.iter_group(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (<Series: 0> <Index> b 0 a 11 <<U1> <int64>, <Series: 1> <Index> b 8 a 4 <<U1> <int64>)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame() <Frame> <Index> b a <<U1> <Index> 0 0 11 1 8 4 <int64> <int64> <int64>
- Frame.iter_group(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).keys()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).__iter__()) (0, 1)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((0, <Series: 0> <Index> b-min 0 b-max 3 <<U5> <int64>), (1, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>))
- Frame.iter_group(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (<Series: 0> <Index> b-min 0 b-max 3 <<U5> <int64>, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>)
- Frame.iter_group(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group
Iterator of
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).to_frame() <Frame> <Index> b-min b-max <<U5> <Index> 0 0 3 1 8 8 <int64> <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c')) (array([[11, 0, 0], [10, 3, 0]]), array([[4, 8, 1], [2, 8, 1]]))
- Frame.iter_group_array(key, *, axis, drop).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').apply(lambda a: np.sum(a)) <Series> <Index: c> 0 24 1 24 <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop).apply_iter(func)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').apply_iter(lambda a: np.sum(a))) (24, 24)
- Frame.iter_group_array(key, *, axis, drop).apply_iter_items(func)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').apply_iter_items(lambda a: np.sum(a))) ((0, 24), (1, 24))
- Frame.iter_group_array(key, *, axis, drop).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
>>> def func(a): return np.sum(a) >>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').apply_pool(func, use_threads=True) <Series> <Index: c> 0 24 1 24 <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop).reduce.from_func(func, *, fill_value).keys()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_func(lambda a: a.sum(axis=0)).keys()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_func(lambda a: a.sum(axis=0)).__iter__()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_func(func, *, fill_value).items()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_func(lambda a: a.sum(axis=0)).items()) ((0, array([21, 3, 0])), (1, array([ 6, 16, 2])))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_func(func, *, fill_value).values()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_func(lambda a: a.sum(axis=0)).values()) (array([21, 3, 0]), array([ 6, 16, 2]))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').reduce.from_func(lambda a: a.sum(axis=0)).to_frame() <Frame> <Index> 0 <int64> <Index> 0 21 1 3 2 0 3 6 4 16 5 2 <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_map_func(np.min).keys()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_map_func(np.min).__iter__()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).items()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_map_func(np.min).items()) ((0, array([10, 0, 0])), (1, array([2, 8, 1])))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).values()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_map_func(np.min).values()) (array([10, 0, 0]), array([2, 8, 1]))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').reduce.from_map_func(np.min).to_frame() <Frame> <Index> a b c <<U1> <Index> 0 10 0 0 1 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((0, array([ 0, 11])), (1, array([8, 4])))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (array([ 0, 11]), array([8, 4]))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame() <Frame> <Index> b a <<U1> <Index> 0 0 11 1 8 4 <int64> <int64> <int64>
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).keys()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).__iter__()) (0, 1)
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((0, array([0, 3])), (1, array([8, 8])))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (array([0, 3]), array([8, 8]))
- Frame.iter_group_array(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array
Iterator of
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array('c').reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).to_frame() <Frame> <Index> b-min b-max <<U5> <Index> 0 0 3 1 8 8 <int64> <int64> <int64>
- Frame.iter_group_array_items(key, *, axis, drop)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c')) ((0, array([[11, 0, 0], [10, 3, 0]])), (1, array([[4, 8, 1], [2, 8, 1]])))
- Frame.iter_group_array_items(key, *, axis, drop).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array_items('c').apply(lambda k, v: np.sum(v) if k == 0 else v.shape) <Series> <Index: c> 0 24 1 (2, 3) <int64> <object>
- Frame.iter_group_array_items(key, *, axis, drop).apply_iter(func)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').apply_iter(lambda k, v: np.sum(v) if k == 0 else v.shape)) (24, (2, 3))
- Frame.iter_group_array_items(key, *, axis, drop).apply_iter_items(func)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').apply_iter_items(lambda k, v: np.sum(v) if k == 0 else v.shape)) ((0, 24), (1, (2, 3)))
- Frame.iter_group_array_items(key, *, axis, drop).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).keys()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_func(lambda l, a: a.sum(axis=0)).keys()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_func(lambda l, a: a.sum(axis=0)).__iter__()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).items()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_func(lambda l, a: a.sum(axis=0)).items()) ((0, array([21, 3, 0])), (1, array([ 6, 16, 2])))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).values()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_func(lambda l, a: a.sum(axis=0)).values()) (array([21, 3, 0]), array([ 6, 16, 2]))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array_items('c').reduce.from_func(lambda l, a: a.sum(axis=0)).to_frame() <Frame> <Index> 0 <int64> <Index> 0 21 1 3 2 0 3 6 4 16 5 2 <int64> <int64>
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_map_func(lambda l, a: np.min(a)).keys()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_map_func(lambda l, a: np.min(a)).__iter__()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).items()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_map_func(lambda l, a: np.min(a)).items()) ((0, array([10, 0, 0])), (1, array([2, 8, 1])))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).values()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_map_func(lambda l, a: np.min(a)).values()) (array([10, 0, 0]), array([2, 8, 1]))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array_items('c').reduce.from_map_func(lambda l, a: np.min(a)).to_frame() <Frame> <Index> a b c <<U1> <Index> 0 10 0 0 1 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).keys()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).__iter__()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).items()) ((0, array([ 0, 11])), (1, array([8, 4])))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).values()) (array([ 0, 11]), array([8, 4]))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array_items('c').reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).to_frame() <Frame> <Index> b a <<U1> <Index> 0 0 11 1 8 4 <int64> <int64> <int64>
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).keys()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).__iter__()) (0, 1)
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).items()) ((0, array([0, 3])), (1, array([8, 8])))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_array_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).values()) (array([0, 3]), array([8, 8]))
- Frame.iter_group_array_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_array_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).to_frame() <Frame> <Index> b-min b-max <<U5> <Index> 0 0 3 1 8 8 <int64> <int64> <int64>
- Frame.iter_group_items(key, *, axis, drop)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c')) ((0, <Frame> <Index> a b c <<U1> <Index> 0 11 0 0 2 10 3 0 <int64> <int64> <int64> <int64>), (1, <Frame> <Index> a b c <<U1> <Index> 1 4 8 1 3 2 8 1 <int64> <int64> <int64> <int64>))
- Frame.iter_group_items(key, *, axis, drop).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_items('c').apply(lambda k, v: v['b'].sum() if k == 0 else v.shape) <Series> <Index: c> 0 3 1 (2, 3) <int64> <object>
- Frame.iter_group_items(key, *, axis, drop).apply_iter(func)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').apply_iter(lambda k, v: v['b'].sum() if k == 0 else v.shape)) (3, (2, 3))
- Frame.iter_group_items(key, *, axis, drop).apply_iter_items(func)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').apply_iter_items(lambda k, v: v['b'].sum() if k == 0 else v.shape)) ((0, 3), (1, (2, 3)))
- Frame.iter_group_items(key, *, axis, drop).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).keys()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_func(lambda l, f: f.iloc[1:]).keys()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_func(lambda l, f: f.iloc[1:]).__iter__()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).items()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_func(lambda l, f: f.iloc[1:]).items()) ((0, <Frame> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>), (1, <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>))
- Frame.iter_group_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).values()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_func(lambda l, f: f.iloc[1:]).values()) (<Frame> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_items('c').reduce.from_func(lambda l, f: f.iloc[1:]).to_frame() <Frame> <Index> a b c <<U1> <Index> 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_map_func(lambda l, s: np.min(s)).keys()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_map_func(lambda l, s: np.min(s)).__iter__()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).items()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_map_func(lambda l, s: np.min(s)).items()) ((0, <Series: 0> <Index> a 10 b 0 c 0 <<U1> <int64>), (1, <Series: 1> <Index> a 2 b 8 c 1 <<U1> <int64>))
- Frame.iter_group_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).values()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_map_func(lambda l, s: np.min(s)).values()) (<Series: 0> <Index> a 10 b 0 c 0 <<U1> <int64>, <Series: 1> <Index> a 2 b 8 c 1 <<U1> <int64>)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_items('c').reduce.from_map_func(lambda l, s: np.min(s)).to_frame() <Frame> <Index> a b c <<U1> <Index> 0 10 0 0 1 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).keys()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).__iter__()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).items()) ((0, <Series: 0> <Index> b 0 a 11 <<U1> <int64>), (1, <Series: 1> <Index> b 8 a 4 <<U1> <int64>))
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).values()) (<Series: 0> <Index> b 0 a 11 <<U1> <int64>, <Series: 1> <Index> b 8 a 4 <<U1> <int64>)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_items('c').reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).to_frame() <Frame> <Index> b a <<U1> <Index> 0 0 11 1 8 4 <int64> <int64> <int64>
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).keys()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).__iter__()) (0, 1)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).items()) ((0, <Series: 0> <Index> b-min 0 b-max 3 <<U5> <int64>), (1, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>))
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).values()) (<Series: 0> <Index> b-min 0 b-max 3 <<U5> <int64>, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>)
- Frame.iter_group_items(key, *, axis, drop).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_items
Iterator of pairs of label,
Frame
grouped by unique values found in one or more columns (axis=0) or rows (axis=1).
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_items('c').reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).to_frame() <Frame> <Index> b-min b-max <<U5> <Index> 0 0 3 1 8 8 <int64> <int64> <int64>
- Frame.iter_group_labels(depth_level, *, axis)
- iter_group_labels
Iterator of
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels(1)) (<Frame> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 1 p 8 True 1517-12-31 <int64> <<U1> <int64> <bool> <datetime64[D]>, <Frame> <Index> a b c <<U1> <IndexHierarchy> 0 q 2 True 1517-04-01 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]>)
- Frame.iter_group_labels(depth_level, *, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels
Iterator of
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> f.iter_group_labels(1).apply(lambda f: f['b'].sum()) <Series> <Index> p 1 q 1 <<U1> <int64>
- Frame.iter_group_labels(depth_level, *, axis).apply_iter(func)
- iter_group_labels
Iterator of
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels(1).apply_iter(lambda f: f['b'].sum())) (1, 1)
- Frame.iter_group_labels(depth_level, *, axis).apply_iter_items(func)
- iter_group_labels
Iterator of
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels(1).apply_iter_items(lambda f: f['b'].sum())) (('p', 1), ('q', 1))
- Frame.iter_group_labels(depth_level, *, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels
Iterator of
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_labels_array(depth_level, *, axis)
- iter_group_labels_array
Iterator of
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array(1)) (array([[10, False, datetime.date(1517, 1, 1)], [8, True, datetime.date(1517, 12, 31)]], dtype=object), array([[2, True, datetime.date(1517, 4, 1)], [3, False, datetime.date(1517, 6, 30)]], dtype=object))
- Frame.iter_group_labels_array(depth_level, *, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_array
Iterator of
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> f.iter_group_labels_array(1).apply(lambda a: np.sum(a[:, 0])) <Series> <Index> p 18 q 5 <<U1> <int64>
- Frame.iter_group_labels_array(depth_level, *, axis).apply_iter(func)
- iter_group_labels_array
Iterator of
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array(1).apply_iter(lambda a: np.sum(a[:, 0]))) (18, 5)
- Frame.iter_group_labels_array(depth_level, *, axis).apply_iter_items(func)
- iter_group_labels_array
Iterator of
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array(1).apply_iter_items(lambda a: np.sum(a[:, 0]))) (('p', 18), ('q', 5))
- Frame.iter_group_labels_array(depth_level, *, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_array
Iterator of
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_labels_array_items(depth_level, *, axis)
- iter_group_labels_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array_items(1)) (('p', array([[10, False, datetime.date(1517, 1, 1)], [8, True, datetime.date(1517, 12, 31)]], dtype=object)), ('q', array([[2, True, datetime.date(1517, 4, 1)], [3, False, datetime.date(1517, 6, 30)]], dtype=object)))
- Frame.iter_group_labels_array_items(depth_level, *, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> f.iter_group_labels_array_items(1).apply(lambda k, v: np.sum(v[:, 0]) if k != 'p' else -1) <Series> <Index> p -1 q 5 <<U1> <int64>
- Frame.iter_group_labels_array_items(depth_level, *, axis).apply_iter(func)
- iter_group_labels_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array_items(1).apply_iter(lambda k, v: np.sum(v[:, 0]) if k != 'p' else -1)) (-1, 5)
- Frame.iter_group_labels_array_items(depth_level, *, axis).apply_iter_items(func)
- iter_group_labels_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_array_items(1).apply_iter_items(lambda k, v: np.sum(v[:, 0]) if k != 'p' else -1)) (('p', -1), ('q', 5))
- Frame.iter_group_labels_array_items(depth_level, *, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_array_items
Iterator of pairs of label,
np.ndarray
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_labels_items(depth_level, *, axis)
- iter_group_labels_items
Iterator of pairs of label,
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_items(1)) (('p', <Frame> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 1 p 8 True 1517-12-31 <int64> <<U1> <int64> <bool> <datetime64[D]>), ('q', <Frame> <Index> a b c <<U1> <IndexHierarchy> 0 q 2 True 1517-04-01 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]>))
- Frame.iter_group_labels_items(depth_level, *, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_items
Iterator of pairs of label,
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)[source]
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> f.iter_group_labels_items(1).apply(lambda k, v: v['b'].sum() if k == 'p' else -1) <Series> <Index> p 1 q -1 <<U1> <int64>
- Frame.iter_group_labels_items(depth_level, *, axis).apply_iter(func)
- iter_group_labels_items
Iterator of pairs of label,
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter(func)[source]
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_items(1).apply_iter(lambda k, v: v['b'].sum() if k == 'p' else -1)) (1, -1)
- Frame.iter_group_labels_items(depth_level, *, axis).apply_iter_items(func)
- iter_group_labels_items
Iterator of pairs of label,
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_iter_items(func)[source]
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> 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')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x') >>> f <Frame: x> <Index> a b c <<U1> <IndexHierarchy> 0 p 10 False 1517-01-01 0 q 2 True 1517-04-01 1 p 8 True 1517-12-31 1 q 3 False 1517-06-30 <int64> <<U1> <int64> <bool> <datetime64[D]> >>> tuple(f.iter_group_labels_items(1).apply_iter_items(lambda k, v: v['b'].sum() if k == 'p' else -1)) (('p', 1), ('q', -1))
- Frame.iter_group_labels_items(depth_level, *, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_items
Iterator of pairs of label,
Frame
grouped by unique labels found in one or more index depths (axis=0) or columns depths (axis=1).
- IterNodeDelegate.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)[source]
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_other(other, *, fill_value, axis)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 2)) (<Frame> <Index> a b c <<U1> <Index> 0 11 0 0 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> 1 4 8 1 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_group_other(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other(np.arange(len(f)) % 2).apply(lambda f: f['b'].sum()) <Series> <Index> 0 3 1 16 <int64> <int64>
- Frame.iter_group_other(other, *, fill_value, axis).apply_iter(func)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 2).apply_iter(lambda f: f['b'].sum())) (3, 16)
- Frame.iter_group_other(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 2).apply_iter_items(lambda f: f['b'].sum())) ((0, 3), (1, 16))
- Frame.iter_group_other(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).keys()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_func(lambda f: f.iloc[1:]).keys()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_func(lambda f: f.iloc[1:]).__iter__()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).items()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_func(lambda f: f.iloc[1:]).items()) ((0, <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>), (1, <Frame> <Index> a b c <<U1> <Index> <int64> <int64> <int64> <int64>), (2, <Frame> <Index> a b c <<U1> <Index> <int64> <int64> <int64> <int64>))
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).values()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_func(lambda f: f.iloc[1:]).values()) (<Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> <int64> <int64> <int64> <int64>, <Frame> <Index> a b c <<U1> <Index> <int64> <int64> <int64> <int64>)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other(np.arange(len(f)) % 3).reduce.from_func(lambda f: f.iloc[1:]).to_frame() <Frame> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_map_func(np.min).keys()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_map_func(np.min).__iter__()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).items()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_map_func(np.min).items()) ((0, <Series: 0> <Index> a 2 b 0 c 0 <<U1> <int64>), (1, <Series: 1> <Index> a 4 b 8 c 1 <<U1> <int64>), (2, <Series: 2> <Index> a 10 b 3 c 0 <<U1> <int64>))
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).values()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_map_func(np.min).values()) (<Series: 0> <Index> a 2 b 0 c 0 <<U1> <int64>, <Series: 1> <Index> a 4 b 8 c 1 <<U1> <int64>, <Series: 2> <Index> a 10 b 3 c 0 <<U1> <int64>)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other(np.arange(len(f)) % 3).reduce.from_map_func(np.min).to_frame() <Frame> <Index> a b c <<U1> <Index> 0 2 0 0 1 4 8 1 2 10 3 0 <int64> <int64> <int64> <int64>
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((0, <Series: 0> <Index> b 0 a 11 <<U1> <int64>), (1, <Series: 1> <Index> b 8 a 4 <<U1> <int64>), (2, <Series: 2> <Index> b 3 a 10 <<U1> <int64>))
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (<Series: 0> <Index> b 0 a 11 <<U1> <int64>, <Series: 1> <Index> b 8 a 4 <<U1> <int64>, <Series: 2> <Index> b 3 a 10 <<U1> <int64>)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame() <Frame> <Index> b a <<U1> <Index> 0 0 11 1 8 4 2 3 10 <int64> <int64> <int64>
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).keys()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).__iter__()) (0, 1, 2)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((0, <Series: 0> <Index> b-min 0 b-max 8 <<U5> <int64>), (1, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>), (2, <Series: 2> <Index> b-min 3 b-max 3 <<U5> <int64>))
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (<Series: 0> <Index> b-min 0 b-max 8 <<U5> <int64>, <Series: 1> <Index> b-min 8 b-max 8 <<U5> <int64>, <Series: 2> <Index> b-min 3 b-max 3 <<U5> <int64>)
- Frame.iter_group_other(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).to_frame() <Frame> <Index> b-min b-max <<U5> <Index> 0 0 8 1 8 8 2 3 3 <int64> <int64> <int64>
- Frame.iter_group_other_array(other, *, fill_value, axis)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 2)) (array([[11, 0, 0], [10, 3, 0]]), array([[4, 8, 1], [2, 8, 1]]))
- Frame.iter_group_other_array(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply(func, *, dtype=None, name=None, index_constructor=None, columns_constructor=None)
Apply a function to each value. Returns a new container.
- Parameters:
func – A function that takes a value.
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other_array(np.arange(len(f)) % 2).apply(lambda a: np.sum(a)) <Series> <Index> 0 24 1 24 <int64> <int64>
- Frame.iter_group_other_array(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_iter(func)
Apply a function to each value. A generator of resulting values.
- Parameters:
func – A function that takes a value.
- Yields:
Values after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 2).apply_iter(lambda a: np.sum(a))) (24, 24)
- Frame.iter_group_other_array(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_iter_items(func)
Apply a function to each value. A generator of resulting key, value pairs.
- Parameters:
func – A function that takes a value.
- Yields:
Pairs of label, value after function application.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 2).apply_iter_items(lambda a: np.sum(a))) ((0, 24), (1, 24))
- Frame.iter_group_other_array(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- IterNodeDelegateReducible.apply_pool(func, *, dtype=None, name=None, index_constructor=None, max_workers=None, chunksize=1, use_threads=False)
Apply a function to each value. Employ parallel processing with either the ProcessPoolExecutor or ThreadPoolExecutor.
- Parameters:
func – A function that takes a value.
* –
dtype – A value suitable for specyfying a NumPy dtype, such as a Python type (float), NumPy array protocol strings (‘f8’), or a dtype instance.
name – A hashable object to label the container.
max_workers – Number of parallel executors, as passed to the Thread- or ProcessPoolExecutor;
None
defaults to the max number of machine processes.chunksize – Units of work per executor, as passed to the Thread- or ProcessPoolExecutor.
use_threads – Use the ThreadPoolExecutor instead of the ProcessPoolExecutor.
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).keys()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_func(lambda a: a.sum(axis=0)).keys()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_func(lambda a: a.sum(axis=0)).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).items()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_func(lambda a: a.sum(axis=0)).items()) ((0, array([13, 8, 1])), (1, array([4, 8, 1])), (2, array([10, 3, 0])))
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).values()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_func(lambda a: a.sum(axis=0)).values()) (array([13, 8, 1]), array([4, 8, 1]), array([10, 3, 0]))
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_func(func, *, fill_value=nan)[source]
For each Frame, and given a function func that returns either a Series or a Frame, call that function on each Frame.
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_func(lambda a: a.sum(axis=0)).to_frame() <Frame> <Index> 0 <int64> <Index> 0 13 1 8 2 1 3 4 4 8 5 1 6 10 7 3 8 0 <int64> <int64>
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_map_func(np.min).keys()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_map_func(np.min).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).items()
- iter_group_other_array
Iterator of
Frame
grouped by unique values found in a supplied container.
- ReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> f = sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x') >>> f <Frame: x> <Index> a b c <<U1> <Index> 0 11 0 0 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64> >>> tuple(f.iter_group_other_array(np.arange(len(f)) % 3).reduce.from_map_func(np.min).items()) ((0, array([2, 0, 0])), (1, array([4, 8, 1])), (2, array([10, 3, 0])))