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])))
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).values()
- 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).values()) (array([2, 0, 0]), array([4, 8, 1]), array([10, 3, 0]))
- Frame.iter_group_other_array(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_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> >>> f.iter_group_other_array(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_array(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((0, array([ 0, 11])), (1, array([8, 4])), (2, array([ 3, 10])))
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (array([ 0, 11]), array([8, 4]), array([ 3, 10]))
- Frame.iter_group_other_array(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_array
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_array(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_array(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_other_array
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_array(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_array(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_other_array
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_array(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_array(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((0, array([0, 8])), (1, array([8, 8])), (2, array([3, 3])))
- Frame.iter_group_other_array(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_other_array
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_array(np.arange(len(f)) % 3).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (array([0, 8]), array([8, 8]), array([3, 3]))
- Frame.iter_group_other_array(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_array
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_array(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_items(other, *, fill_value, axis)
- iter_group_other_array_items
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_items(np.arange(len(f)) % 2)) ((0, array([[11, 0, 0], [10, 3, 0]])), (1, array([[4, 8, 1], [2, 8, 1]])))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_array_items
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_items(np.arange(len(f)) % 2).apply(lambda k, v: np.sum(v) if k == 0 else v.shape) <Series> <Index> 0 24 1 (2, 3) <int64> <object>
- Frame.iter_group_other_array_items(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_array_items
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_items(np.arange(len(f)) % 2).apply_iter(lambda k, v: np.sum(v) if k == 0 else v.shape)) (24, (2, 3))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_array_items
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_items(np.arange(len(f)) % 2).apply_iter_items(lambda k, v: np.sum(v) if k == 0 else v.shape)) ((0, 24), (1, (2, 3)))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other_array_items
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_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).keys()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, a: a.sum(axis=0)).keys()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, a: a.sum(axis=0)).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).items()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, 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_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).values()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, a: a.sum(axis=0)).values()) (array([13, 8, 1]), array([4, 8, 1]), array([10, 3, 0]))
- Frame.iter_group_other_array_items(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_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, 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_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, a: np.min(a)).keys()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, a: np.min(a)).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).items()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, a: np.min(a)).items()) ((0, array([2, 0, 0])), (1, array([4, 8, 1])), (2, array([10, 3, 0])))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).values()
- iter_group_other_array_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, a: np.min(a)).values()) (array([2, 0, 0]), array([4, 8, 1]), array([10, 3, 0]))
- Frame.iter_group_other_array_items(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_array_items
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_array_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, a: np.min(a)).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_array_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).keys()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).__iter__()) (0, 1, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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])), (2, array([ 3, 10])))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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]), array([ 3, 10]))
- Frame.iter_group_other_array_items(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_array_items
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_array_items(np.arange(len(f)) % 3).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 2 3 10 <int64> <int64> <int64>
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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, 2)
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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, 8])), (1, array([8, 8])), (2, array([3, 3])))
- Frame.iter_group_other_array_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_other_array_items
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_array_items(np.arange(len(f)) % 3).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, 8]), array([8, 8]), array([3, 3]))
- Frame.iter_group_other_array_items(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_array_items
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_array_items(np.arange(len(f)) % 3).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 8 1 8 8 2 3 3 <int64> <int64> <int64>
- Frame.iter_group_other_items(other, *, fill_value, axis)
- iter_group_other_items
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_items(np.arange(len(f)) % 2)) ((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_other_items(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_items
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_items(np.arange(len(f)) % 2).apply(lambda k, v: v['b'].sum() if k == 0 else v.shape) <Series> <Index> 0 3 1 (2, 3) <int64> <object>
- Frame.iter_group_other_items(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_items
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_items(np.arange(len(f)) % 2).apply_iter(lambda k, v: v['b'].sum() if k == 0 else v.shape)) (3, (2, 3))
- Frame.iter_group_other_items(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_items
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_items(np.arange(len(f)) % 2).apply_iter_items(lambda k, v: v['b'].sum() if k == 0 else v.shape)) ((0, 3), (1, (2, 3)))
- Frame.iter_group_other_items(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other_items
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_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).keys()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, f: f.iloc[1:]).keys()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).__iter__()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, f: f.iloc[1:]).__iter__()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).items()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, 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_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).values()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, 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_items(other, *, fill_value, axis).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_func(lambda l, 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_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).keys()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, s: np.min(s)).keys()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, s: np.min(s)).__iter__()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).items()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, s: np.min(s)).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_items(other, *, fill_value, axis).reduce.from_map_func(func, *, fill_value).values()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, s: np.min(s)).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_items(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_items
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_items(np.arange(len(f)) % 3).reduce.from_map_func(lambda l, s: np.min(s)).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_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).keys()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).__iter__()) (0, 1, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).items()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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>), (2, <Series: 2> <Index> b 3 a 10 <<U1> <int64>))
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_map(func_map, *, fill_value).values()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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>, <Series: 2> <Index> b 3 a 10 <<U1> <int64>)
- Frame.iter_group_other_items(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_items
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_items(np.arange(len(f)) % 3).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 2 3 10 <int64> <int64> <int64>
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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, 2)
- Frame.iter_group_other_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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 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_items(other, *, fill_value, axis).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_group_other_items
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_items(np.arange(len(f)) % 3).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 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_items(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_items
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_items(np.arange(len(f)) % 3).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 8 1 8 8 2 3 3 <int64> <int64> <int64>
- Frame.iter_series(*, axis)
-
>>> 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_series()) (<Series: a> <Index> p 10 q -2 r 0 s 0 <<U1> <int64>, <Series: b> <Index> p 8 q -3 r 8 s 0 <<U1> <int64>, <Series: c> <Index> p 1 q 0 r 9 s 12 <<U1> <int64>)
- Frame.iter_series(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
-
- 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_series().apply(lambda v: v.sum()) <Series> <Index> a 8 b 13 c 22 <<U1> <int64>
- Frame.iter_series(*, axis).apply_iter(func)
-
- 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_series().apply_iter(lambda v: v.sum())) (8, 13, 22)
- Frame.iter_series(*, axis).apply_iter_items(func)
-
- 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_series().apply_iter_items(lambda v: v.sum())) (('a', 8), ('b', 13), ('c', 22))
- Frame.iter_series(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
-
- 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_series().apply_pool(lambda v: v.sum(), use_threads=True) <Series> <Index> a 8 b 13 c 22 <<U1> <int64>
- Frame.iter_series_items(*, axis)
- iter_series_items
Iterator of pairs of label,
Series
, whereSeries
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_series_items()) (('a', <Series: a> <Index> p 10 q -2 r 0 s 0 <<U1> <int64>), ('b', <Series: b> <Index> p 8 q -3 r 8 s 0 <<U1> <int64>), ('c', <Series: c> <Index> p 1 q 0 r 9 s 12 <<U1> <int64>))
- Frame.iter_series_items(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_series_items
Iterator of pairs of label,
Series
, whereSeries
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_series_items().apply(lambda k, v: v.sum() if k != 'b' else -1) <Series> <Index> a 8 b -1 c 22 <<U1> <int64>
- Frame.iter_series_items(*, axis).apply_iter(func)
- iter_series_items
Iterator of pairs of label,
Series
, whereSeries
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_series_items().apply_iter(lambda k, v: v.sum() if k != 'b' else -1)) (8, -1, 22)
- Frame.iter_series_items(*, axis).apply_iter_items(func)
- iter_series_items
Iterator of pairs of label,
Series
, whereSeries
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_series_items().apply_iter_items(lambda k, v: v.sum() if k != 'b' else -1)) (('a', 8), ('b', -1), ('c', 22))
- Frame.iter_series_items(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_series_items
Iterator of pairs of label,
Series
, whereSeries
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_series_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_tuple(*, axis, constructor)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
>>> 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_tuple()) (Axis(p=10, q=-2, r=0, s=0), Axis(p=8, q=-3, r=8, s=0), Axis(p=1, q=0, r=9, s=12))
- Frame.iter_tuple(*, axis, constructor).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().apply(lambda v: v.p + v.q) <Series> <Index> a 8 b 5 c 1 <<U1> <int64>
- Frame.iter_tuple(*, axis, constructor).apply_iter(func)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().apply_iter(lambda v: v.p + v.q)) (8, 5, 1)
- Frame.iter_tuple(*, axis, constructor).apply_iter_items(func)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().apply_iter_items(lambda v: v.p + v.q)) (('a', 8), ('b', 5), ('c', 1))
- Frame.iter_tuple(*, axis, constructor).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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.
- Frame.iter_tuple(*, axis, constructor).map_all(mapping, *, dtype, name, index_constructor)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_all({(2, 9): -1, (3, 8): -2}) <Series> <Index> a -1 b -2 <<U1> <int64>
- Frame.iter_tuple(*, axis, constructor).map_all_iter(mapping)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_all_iter({(2, 9): -1, (3, 8): -2})) (-1, -2)
- Frame.iter_tuple(*, axis, constructor).map_all_iter_items(mapping)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_all_iter_items({(2, 9): -1, (3, 8): -2})) (('a', -1), ('b', -2))
- Frame.iter_tuple(*, axis, constructor).map_any(mapping, *, dtype, name, index_constructor)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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> >>> tuple(f.iter_tuple().map_any({(2, 9): -1})) ('a', 'b')
- Frame.iter_tuple(*, axis, constructor).map_any_iter(mapping)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_any_iter({(2, 9): -1})) (-1, Axis(p=3, q=8))
- Frame.iter_tuple(*, axis, constructor).map_any_iter_items(mapping)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_any_iter_items({(2, 9): -1})) (('a', -1), ('b', Axis(p=3, q=8)))
- Frame.iter_tuple(*, axis, constructor).map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_fill({(2, 9): -1}, fill_value=np.nan) <Series> <Index> a -1.0 b nan <<U1> <float64>
- Frame.iter_tuple(*, axis, constructor).map_fill_iter(mapping, *, fill_value)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_fill_iter({(2, 9): -1}, fill_value=np.nan)) (-1, nan)
- Frame.iter_tuple(*, axis, constructor).map_fill_iter_items(mapping, *, fill_value)
- iter_tuple
Iterator of
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1). An optionalconstructor
callable can be used to provide aNamedTuple
class (or any other constructor called with a single iterable) to be used to create each yielded axis value.
- 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_tuple().map_fill_iter_items({(2, 9): -1}, fill_value=np.nan)) (('a', -1), ('b', nan))
- Frame.iter_tuple_items(*, axis, constructor)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples 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_tuple_items()) (('a', Axis(p=10, q=-2, r=0, s=0)), ('b', Axis(p=8, q=-3, r=8, s=0)), ('c', Axis(p=1, q=0, r=9, s=12)))
- Frame.iter_tuple_items(*, axis, constructor).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().apply(lambda k, v: v.p + v.q if k == 'b' else -1) <Series> <Index> a -1 b 5 c -1 <<U1> <int64>
- Frame.iter_tuple_items(*, axis, constructor).apply_iter(func)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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') >>> tuple(f.iter_tuple_items().apply_iter(lambda k, v: v.p + v.q if k == 'b' else -1)) (-1, 5, -1)
- Frame.iter_tuple_items(*, axis, constructor).apply_iter_items(func)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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') >>> tuple(f.iter_tuple_items().apply_iter_items(lambda k, v: v.p + v.q if k == 'b' else -1)) (('a', -1), ('b', 5), ('c', -1))
- Frame.iter_tuple_items(*, axis, constructor).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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.
- Frame.iter_tuple_items(*, axis, constructor).map_all(mapping, *, dtype, name, index_constructor)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_all({('a', (2, 9)): -1, ('b', (3, 8)): -2}) <Series> <Index> a -1 b -2 <<U1> <int64>
- Frame.iter_tuple_items(*, axis, constructor).map_all_iter(mapping)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_all_iter({('a', (2, 9)): -1, ('b', (3, 8)): -2})) (-1, -2)
- Frame.iter_tuple_items(*, axis, constructor).map_all_iter_items(mapping)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_all_iter_items({('a', (2, 9)): -1, ('b', (3, 8)): -2})) (('a', -1), ('b', -2))
- Frame.iter_tuple_items(*, axis, constructor).map_any(mapping, *, dtype, name, index_constructor)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_any({('a', (2, 9)): -1}) <Series> <Index> a -1 b Axis(p=3, q=8) <<U1> <object>
- Frame.iter_tuple_items(*, axis, constructor).map_any_iter(mapping)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_any_iter({('a', (2, 9)): -1})) (-1, Axis(p=3, q=8))
- Frame.iter_tuple_items(*, axis, constructor).map_any_iter_items(mapping)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_any_iter_items({('a', (2, 9)): -1})) (('a', -1), ('b', Axis(p=3, q=8)))
- Frame.iter_tuple_items(*, axis, constructor).map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_fill({('a', (2, 9)): -1}, fill_value=np.nan) <Series> <Index> a -1.0 b nan <<U1> <float64>
- Frame.iter_tuple_items(*, axis, constructor).map_fill_iter(mapping, *, fill_value)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_fill_iter({('a', (2, 9)): -1}, fill_value=np.nan)) (-1, nan)
- Frame.iter_tuple_items(*, axis, constructor).map_fill_iter_items(mapping, *, fill_value)
- iter_tuple_items
Iterator of pairs of label,
NamedTuple
, where tuples are drawn from columns (axis=0) or rows (axis=1)
- 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_tuple_items().map_fill_iter_items({('a', (2, 9)): -1}, fill_value=np.nan)) (('a', -1), ('b', nan))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
>>> 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_window(size=2, step=1)) (<Frame: x> <Index> a b c <<U1> <Index> p 10 8 1 q -2 -3 0 <<U1> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> q -2 -3 0 r 0 8 9 <<U1> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> r 0 8 9 s 0 0 12 <<U1> <int64> <int64> <int64>)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window(size=2, step=1).apply(lambda f: f.max().max()) <Series> <Index> q 10 r 9 s 12 <<U1> <int64>
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter(func)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window(size=2, step=1).apply_iter(lambda f: f.max().max())) (10, 9, 12)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter_items(func)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window(size=2, step=1).apply_iter_items(lambda f: f.max().max())) (('q', 10), ('r', 9), ('s', 12))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).keys()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_func(lambda f: f.iloc[1:]).keys()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).__iter__()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_func(lambda f: f.iloc[1:]).__iter__()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).items()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_func(lambda f: f.iloc[1:]).items()) ((1, <Frame: x> <Index> a b c <<U1> <Index> 1 4 8 1 <int64> <int64> <int64> <int64>), (2, <Frame: x> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>), (3, <Frame: x> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).values()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_func(lambda f: f.iloc[1:]).values()) (<Frame: x> <Index> a b c <<U1> <Index> 1 4 8 1 <int64> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_func(lambda f: f.iloc[1:]).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).keys()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_map_func(np.min).keys()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_map_func(np.min).__iter__()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).items()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_map_func(np.min).items()) ((1, <Series: 1> <Index> a 4 b 0 c 0 <<U1> <int64>), (2, <Series: 2> <Index> a 4 b 3 c 0 <<U1> <int64>), (3, <Series: 3> <Index> a 2 b 3 c 0 <<U1> <int64>))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).values()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_map_func(np.min).values()) (<Series: 1> <Index> a 4 b 0 c 0 <<U1> <int64>, <Series: 2> <Index> a 4 b 3 c 0 <<U1> <int64>, <Series: 3> <Index> a 2 b 3 c 0 <<U1> <int64>)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_map_func(np.min).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 0 0 2 4 3 0 3 2 3 0 <int64> <int64> <int64> <int64>
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).items()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((1, <Series: 1> <Index> b 0 a 11 <<U1> <int64>), (2, <Series: 2> <Index> b 3 a 10 <<U1> <int64>), (3, <Series: 3> <Index> b 3 a 10 <<U1> <int64>))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).values()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (<Series: 1> <Index> b 0 a 11 <<U1> <int64>, <Series: 2> <Index> b 3 a 10 <<U1> <int64>, <Series: 3> <Index> b 3 a 10 <<U1> <int64>)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame() <Frame> <Index> b a <<U1> <Index> 1 0 11 2 3 10 3 3 10 <int64> <int64> <int64>
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).keys()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).__iter__()) (1, 2, 3)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((1, <Series: 1> <Index> b-min 0 b-max 8 <<U5> <int64>), (2, <Series: 2> <Index> b-min 3 b-max 8 <<U5> <int64>), (3, <Series: 3> <Index> b-min 3 b-max 8 <<U5> <int64>))
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (<Series: 1> <Index> b-min 0 b-max 8 <<U5> <int64>, <Series: 2> <Index> b-min 3 b-max 8 <<U5> <int64>, <Series: 3> <Index> b-min 3 b-max 8 <<U5> <int64>)
- Frame.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window
Iterator of windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window(size=2, step=1).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> 1 0 8 2 3 8 3 3 8 <int64> <int64> <int64>
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
>>> 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_window_array(size=2, step=1)) (array([[10, 8, 1], [-2, -3, 0]]), array([[-2, -3, 0], [ 0, 8, 9]]), array([[ 0, 8, 9], [ 0, 0, 12]]))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array(size=2, step=1).apply(lambda a: np.max(a)) <Series> <Index> q 10 r 9 s 12 <<U1> <int64>
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter(func)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array(size=2, step=1).apply_iter(lambda a: np.max(a))) (10, 9, 12)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter_items(func)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array(size=2, step=1).apply_iter_items(lambda a: np.max(a))) (('q', 10), ('r', 9), ('s', 12))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).keys()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_func(lambda a: a.sum(axis=0)).keys()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).__iter__()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_func(lambda a: a.sum(axis=0)).__iter__()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).items()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_func(lambda a: a.sum(axis=0)).items()) ((1, array([15, 8, 1])), (2, array([14, 11, 1])), (3, array([12, 11, 1])))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).values()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_func(lambda a: a.sum(axis=0)).values()) (array([15, 8, 1]), array([14, 11, 1]), array([12, 11, 1]))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_func(lambda a: a.sum(axis=0)).to_frame() <Frame> <Index> 0 <int64> <Index> 0 15 1 8 2 1 3 14 4 11 5 1 6 12 7 11 8 1 <int64> <int64>
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).keys()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_map_func(np.min).keys()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_map_func(np.min).__iter__()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).items()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_map_func(np.min).items()) ((1, array([4, 0, 0])), (2, array([4, 3, 0])), (3, array([2, 3, 0])))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).values()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_map_func(np.min).values()) (array([4, 0, 0]), array([4, 3, 0]), array([2, 3, 0]))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_map_func(np.min).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 0 0 2 4 3 0 3 2 3 0 <int64> <int64> <int64> <int64>
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).keys()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).__iter__()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).items()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).items()) ((1, array([ 0, 11])), (2, array([ 3, 10])), (3, array([ 3, 10])))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).values()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).values()) (array([ 0, 11]), array([ 3, 10]), array([ 3, 10]))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame() <Frame> <Index> b a <<U1> <Index> 1 0 11 2 3 10 3 3 10 <int64> <int64> <int64>
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).keys()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).__iter__()) (1, 2, 3)
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).items()) ((1, array([0, 8])), (2, array([3, 8])), (3, array([3, 8])))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).values()) (array([0, 8]), array([3, 8]), array([3, 8]))
- Frame.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array
Iterator of windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array(size=2, step=1).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> 1 0 8 2 3 8 3 3 8 <int64> <int64> <int64>
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
>>> 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_window_array_items(size=2, step=1)) (('q', array([[10, 8, 1], [-2, -3, 0]])), ('r', array([[-2, -3, 0], [ 0, 8, 9]])), ('s', array([[ 0, 8, 9], [ 0, 0, 12]])))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array_items(size=2, step=1).apply(lambda k, v: np.max(v) if k == 'r' else np.min(v)) <Series> <Index> q -3 r 9 s 0 <<U1> <int64>
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter(func)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array_items(size=2, step=1).apply_iter(lambda k, v: np.max(v) if k == 'r' else np.min(v))) (-3, 9, 0)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter_items(func)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_array_items(size=2, step=1).apply_iter_items(lambda k, v: np.max(v) if k == 'r' else np.min(v))) (('q', -3), ('r', 9), ('s', 0))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).keys()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_func(lambda l, a: a.sum(axis=0)).keys()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).__iter__()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_func(lambda l, a: a.sum(axis=0)).__iter__()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).items()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_func(lambda l, a: a.sum(axis=0)).items()) ((1, array([15, 8, 1])), (2, array([14, 11, 1])), (3, array([12, 11, 1])))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).values()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_func(lambda l, a: a.sum(axis=0)).values()) (array([15, 8, 1]), array([14, 11, 1]), array([12, 11, 1]))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_func(lambda l, a: a.sum(axis=0)).to_frame() <Frame> <Index> 0 <int64> <Index> 0 15 1 8 2 1 3 14 4 11 5 1 6 12 7 11 8 1 <int64> <int64>
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).keys()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_map_func(lambda l, a: np.min(a)).keys()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_map_func(lambda l, a: np.min(a)).__iter__()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).items()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_map_func(lambda l, a: np.min(a)).items()) ((1, array([4, 0, 0])), (2, array([4, 3, 0])), (3, array([2, 3, 0])))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).values()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_map_func(lambda l, a: np.min(a)).values()) (array([4, 0, 0]), array([4, 3, 0]), array([2, 3, 0]))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_map_func(lambda l, a: np.min(a)).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 0 0 2 4 3 0 3 2 3 0 <int64> <int64> <int64> <int64>
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).keys()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).__iter__()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).items()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).items()) ((1, array([ 0, 11])), (2, array([ 3, 10])), (3, array([ 3, 10])))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).values()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_map({'b': lambda l, a: np.min(a), 'a': lambda l, a: np.max(a)}).values()) (array([ 0, 11]), array([ 3, 10]), array([ 3, 10]))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).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> 1 0 11 2 3 10 3 3 10 <int64> <int64> <int64>
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).keys()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).__iter__()) (1, 2, 3)
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, a: np.min(a), ('b', 'b-max'): lambda l, a: np.max(a)}).items()) ((1, array([0, 8])), (2, array([3, 8])), (3, array([3, 8])))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).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, 8]), array([3, 8]), array([3, 8]))
- Frame.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_array_items
Iterator of pairs of label, windowed values, where values are given as a
np.array
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_array_items(size=2, step=1).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> 1 0 8 2 3 8 3 3 8 <int64> <int64> <int64>
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
>>> 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_window_items(size=2, step=1)) (('q', <Frame: x> <Index> a b c <<U1> <Index> p 10 8 1 q -2 -3 0 <<U1> <int64> <int64> <int64>), ('r', <Frame: x> <Index> a b c <<U1> <Index> q -2 -3 0 r 0 8 9 <<U1> <int64> <int64> <int64>), ('s', <Frame: x> <Index> a b c <<U1> <Index> r 0 8 9 s 0 0 12 <<U1> <int64> <int64> <int64>))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_items(size=2, step=1).apply(lambda k, v: v.max().max() if k == 'r' else v.min().min()) <Series> <Index> q -3 r 9 s 0 <<U1> <int64>
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter(func)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_items(size=2, step=1).apply_iter(lambda k, v: v.max().max() if k == 'r' else v.min().min())) (-3, 9, 0)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_iter_items(func)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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(((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_window_items(size=2, step=1).apply_iter_items(lambda k, v: v.max().max() if k == 'r' else v.min().min())) (('q', -3), ('r', 9), ('s', 0))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).keys()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_func(lambda l, f: f.iloc[1:]).keys()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).__iter__()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_func(lambda l, f: f.iloc[1:]).__iter__()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).items()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_func(lambda l, f: f.iloc[1:]).items()) ((1, <Frame: x> <Index> a b c <<U1> <Index> 1 4 8 1 <int64> <int64> <int64> <int64>), (2, <Frame: x> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>), (3, <Frame: x> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).values()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_func(lambda l, f: f.iloc[1:]).values()) (<Frame: x> <Index> a b c <<U1> <Index> 1 4 8 1 <int64> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> 2 10 3 0 <int64> <int64> <int64> <int64>, <Frame: x> <Index> a b c <<U1> <Index> 3 2 8 1 <int64> <int64> <int64> <int64>)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_func(lambda l, f: f.iloc[1:]).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 8 1 2 10 3 0 3 2 8 1 <int64> <int64> <int64> <int64>
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).keys()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_map_func(lambda l, s: np.min(s)).keys()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).__iter__()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_map_func(lambda l, s: np.min(s)).__iter__()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).items()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_map_func(lambda l, s: np.min(s)).items()) ((1, <Series: 1> <Index> a 4 b 0 c 0 <<U1> <int64>), (2, <Series: 2> <Index> a 4 b 3 c 0 <<U1> <int64>), (3, <Series: 3> <Index> a 2 b 3 c 0 <<U1> <int64>))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).values()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_map_func(lambda l, s: np.min(s)).values()) (<Series: 1> <Index> a 4 b 0 c 0 <<U1> <int64>, <Series: 2> <Index> a 4 b 3 c 0 <<U1> <int64>, <Series: 3> <Index> a 2 b 3 c 0 <<U1> <int64>)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_map_func(func, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_map_func(lambda l, s: np.min(s)).to_frame() <Frame> <Index> a b c <<U1> <Index> 1 4 0 0 2 4 3 0 3 2 3 0 <int64> <int64> <int64> <int64>
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).keys()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).keys()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).__iter__()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).__iter__()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).items()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).items()) ((1, <Series: 1> <Index> b 0 a 11 <<U1> <int64>), (2, <Series: 2> <Index> b 3 a 10 <<U1> <int64>), (3, <Series: 3> <Index> b 3 a 10 <<U1> <int64>))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).values()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_map({'b': lambda l, s: np.min(s), 'a': lambda l, s: np.max(s)}).values()) (<Series: 1> <Index> b 0 a 11 <<U1> <int64>, <Series: 2> <Index> b 3 a 10 <<U1> <int64>, <Series: 3> <Index> b 3 a 10 <<U1> <int64>)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).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> 1 0 11 2 3 10 3 3 10 <int64> <int64> <int64>
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).keys()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).keys()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).__iter__()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).__iter__()) (1, 2, 3)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).items()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).reduce.from_label_pair_map({('b', 'b-min'): lambda l, s: np.min(s), ('b', 'b-max'): lambda l, s: np.max(s)}).items()) ((1, <Series: 1> <Index> b-min 0 b-max 8 <<U5> <int64>), (2, <Series: 2> <Index> b-min 3 b-max 8 <<U5> <int64>), (3, <Series: 3> <Index> b-min 3 b-max 8 <<U5> <int64>))
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).values()
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).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: 1> <Index> b-min 0 b-max 8 <<U5> <int64>, <Series: 2> <Index> b-min 3 b-max 8 <<U5> <int64>, <Series: 3> <Index> b-min 3 b-max 8 <<U5> <int64>)
- Frame.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, label_missing_skips, label_missing_raises, start_shift, size_increment).reduce.from_label_pair_map(func_map, *, fill_value).to_frame(*, index, columns, index_constructor, columns_constructor, name, consolidate_blocks)
- iter_window_items
Iterator of pairs of label, windowed values, where values are given as a
Frame
.- Parameters:
size – Elements per window, given as an integer greater than 0.
axis – Integer specifying axis, where 0 is rows and 1 is columns. Axis 0 is set by default.
step – Element shift per window, given as an integer greater than 0. Determines the step size between windows. A step of 1 shifts each window 1 element; a step equal to the
size
will result in non-overlapping windows.window_sized – if True, windows with fewer elements than
size
are skipped.window_func – Array processor of window values, executed before function application (if used): can be used for applying a weighting function to each window.
window_valid – Function that, given an array window, returns True if the window is valid; invalid windows are skipped.
label_shift – A shift, relative to the right-most element contained in the window, to derive the label to be paired with the window. For example, to label each window with the label found at the start of the window,
label_shift
can be set to one less thansize
.label_missing_skips – If True, a window that cannot derive a label will skip that window; if False, the window will be returned with None as the label.
label_missing_raises – If True, a window that cannot derive a label will raise an exception.
start_shift – A shift to determine the first element where window collection begins.
size_increment – A value to be added to
size
with each window after the first, so as to, in combination with settingstep
to 0, permit iterating over expanding windows.
- 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_window_items(size=2, step=1).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> 1 0 8 2 3 8 3 3 8 <int64> <int64> <int64>
Frame: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic | Accessor Reduce