Detail: Series: Iterator¶
- Series.iter_element
- iter_element
Iterator of elements.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element()) (2, 8, 19, 34, 54)
- Series.iter_element().apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_element().apply(lambda e: e > 10) <Series> <Index> a False b False c True d True e True <<U1> <bool>
- Series.iter_element().apply_iter(func)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element().apply_iter(lambda e: e > 10)) (False, False, True, True, True)
- Series.iter_element().apply_iter_items(func)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element().apply_iter_items(lambda e: e > 10)) (('a', False), ('b', False), ('c', True), ('d', True), ('e', True))
- Series.iter_element().apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_element
Iterator of elements.
- 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(e): return e > 10 >>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_element().apply_pool(func, use_threads=True) <Series> <Index> a False b False c True d True e True <<U1> <bool>
- Series.iter_element().map_all(mapping, *, dtype, name, index_constructor)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element().map_all({2: 200, 10: -1, 8: 45}) <Series> <Index> a -1 b 200 c 45 <<U1> <int64>
- Series.iter_element().map_all_iter(mapping)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_all_iter({2: 200, 10: -1, 8: 45})) (-1, 200, 45)
- Series.iter_element().map_all_iter_items(mapping)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_all_iter_items({2: 200, 10: -1, 8: 45})) (('a', -1), ('b', 200), ('c', 45))
- Series.iter_element().map_any(mapping, *, dtype, name, index_constructor)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element().map_any({10: -1, 8: 45}) <Series> <Index> a -1 b 2 c 45 <<U1> <int64>
- Series.iter_element().map_any_iter(mapping)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_any_iter({10: -1, 8: 45})) (-1, 2, 45)
- Series.iter_element().map_any_iter_items(mapping)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_any_iter_items({10: -1, 8: 45})) (('a', -1), ('b', 2), ('c', 45))
- Series.iter_element().map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element().map_fill({10: -1, 8: 45}, fill_value=np.nan) <Series> <Index> a -1.0 b nan c 45.0 <<U1> <float64>
- Series.iter_element().map_fill_iter(mapping, *, fill_value)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_fill_iter({10: -1, 8: 45}, fill_value=np.nan)) (-1, nan, 45)
- Series.iter_element().map_fill_iter_items(mapping, *, fill_value)
- iter_element
Iterator of elements.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element().map_fill_iter_items({10: -1, 8: 45}, fill_value=np.nan)) (('a', -1), ('b', nan), ('c', 45))
- Series.iter_element_items
- iter_element_items
Iterator of label, element pairs.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element_items()) (('a', 2), ('b', 8), ('c', 19), ('d', 34), ('e', 54))
- Series.iter_element_items().apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_element_items().apply(lambda l, e: e > 10 if l != 'c' else 0) <Series> <Index> a 0 b 0 c 0 d 1 e 1 <<U1> <int64>
- Series.iter_element_items().apply_iter(func)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element_items().apply_iter(lambda l, e: e > 10 and l != 'e')) (False, False, True, True, False)
- Series.iter_element_items().apply_iter_items(func)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_element_items().apply_iter_items(lambda l, e: e > 10 and l != 'e')) (('a', False), ('b', False), ('c', True), ('d', True), ('e', False))
- Series.iter_element_items().apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_element_items
Iterator of label, element pairs.
- 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] > 10 and pair[0] != 'e' >>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_element_items().apply_pool(func, use_threads=True) <Series> <Index> a False b False c True d True e False <<U1> <bool>
- Series.iter_element_items().map_all(mapping, *, dtype, name, index_constructor)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element_items().map_all({('b', 2): 200, ('a', 10): -1, ('c', 8): 45}) <Series> <Index> a -1 b 200 c 45 <<U1> <int64>
- Series.iter_element_items().map_all_iter(mapping)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_all_iter({('b', 2): 200, ('a', 10): -1, ('c', 8): 45})) (-1, 200, 45)
- Series.iter_element_items().map_all_iter_items(mapping)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_all_iter_items({('b', 2): 200, ('a', 10): -1, ('c', 8): 45})) (('a', -1), ('b', 200), ('c', 45))
- Series.iter_element_items().map_any(mapping, *, dtype, name, index_constructor)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element_items().map_any({('a', 10): -1, ('c', 8): 45}) <Series> <Index> a -1 b 2 c 45 <<U1> <int64>
- Series.iter_element_items().map_any_iter(mapping)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_any_iter({('a', 10): -1, ('c', 8): 45})) (-1, 2, 45)
- Series.iter_element_items().map_any_iter_items(mapping)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_any_iter_items({('a', 10): -1, ('c', 8): 45})) (('a', -1), ('b', 2), ('c', 45))
- Series.iter_element_items().map_fill(mapping, *, fill_value, dtype, name, index_constructor)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> s.iter_element_items().map_fill({('a', 10): -1, ('c', 8): 45}, fill_value=np.nan) <Series> <Index> a -1.0 b nan c 45.0 <<U1> <float64>
- Series.iter_element_items().map_fill_iter(mapping, *, fill_value)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_fill_iter({('a', 10): -1, ('c', 8): 45}, fill_value=np.nan)) (-1, nan, 45)
- Series.iter_element_items().map_fill_iter_items(mapping, *, fill_value)
- iter_element_items
Iterator of label, element pairs.
- 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.
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> s <Series> <Index> a 10 b 2 c 8 <<U1> <int64> >>> tuple(s.iter_element_items().map_fill_iter_items({('a', 10): -1, ('c', 8): 45}, fill_value=np.nan)) (('a', -1), ('b', nan), ('c', 45))
- Series.iter_group(*, axis)
-
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group()) (<Series> <Index> a -2 d -2 <<U1> <int64>, <Series> <Index> b 8 e 8 <<U1> <int64>, <Series> <Index> c 19 <<U1> <int64>)
- Series.iter_group(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group().apply(lambda s: s.sum()) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group().apply_iter(lambda s: s.sum())) (-4, 16, 19)
- Series.iter_group(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group().apply_iter_items(lambda s: s.sum())) ((-2, -4), (8, 16), (19, 19))
- Series.iter_group(*, 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group().apply_pool(func, use_threads=True) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group_array(*, axis)
-
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array()) (array([-2, -2]), array([8, 8]), array([19]))
- Series.iter_group_array(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_array().apply(lambda s: s.sum()) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group_array(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array().apply_iter(lambda s: s.sum())) (-4, 16, 19)
- Series.iter_group_array(*, 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array().apply_iter_items(lambda s: s.sum())) ((-2, -4), (8, 16), (19, 19))
- Series.iter_group_array(*, 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_array().apply_pool(func, use_threads=True) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group_array_items(*, axis)
- iter_group_array_items
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array_items()) ((-2, array([-2, -2])), (8, array([8, 8])), (19, array([19])))
- Series.iter_group_array_items(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_array_items().apply(lambda l, s: s.sum() if l != 8 else s.shape) <Series> <Index> -2 -4 8 (2,) 19 19 <int64> <object>
- Series.iter_group_array_items(*, axis).apply_iter(func)
- iter_group_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array_items().apply_iter(lambda l, s: s.sum() if l != 8 else -1)) (-4, -1, 19)
- Series.iter_group_array_items(*, axis).apply_iter_items(func)
- iter_group_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_array_items().apply_iter_items(lambda l, s: s.sum() if l != 8 else -1)) ((-2, -4), (8, -1), (19, 19))
- Series.iter_group_array_items(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_array_items
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_array_items().apply_pool(func, use_threads=True) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group_items(*, axis)
- iter_group_items
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_items()) ((-2, <Series> <Index> a -2 d -2 <<U1> <int64>), (8, <Series> <Index> b 8 e 8 <<U1> <int64>), (19, <Series> <Index> c 19 <<U1> <int64>))
- Series.iter_group_items(*, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_items().apply(lambda l, s: s.sum() if l != 8 else s.shape) <Series> <Index> -2 -4 8 (2,) 19 19 <int64> <object>
- Series.iter_group_items(*, axis).apply_iter(func)
- iter_group_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_items().apply_iter(lambda l, s: s.sum() if l != 8 else -1)) (-4, -1, 19)
- Series.iter_group_items(*, axis).apply_iter_items(func)
- iter_group_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_items().apply_iter_items(lambda l, s: s.sum() if l != 8 else -1)) ((-2, -4), (8, -1), (19, 19))
- Series.iter_group_items(*, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_items
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_items().apply_pool(func, use_threads=True) <Series> <Index> -2 -4 8 16 19 19 <int64> <int64>
- Series.iter_group_labels(depth_level)
- iter_group_labels
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> tuple(s.iter_group_labels()) (<Series> <Index> a 10 <<U1> <int64>, <Series> <Index> b 2 <<U1> <int64>, <Series> <Index> c 8 <<U1> <int64>)
- Series.iter_group_labels(depth_level).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels().apply(lambda s: s.sum()) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels(depth_level).apply_iter(func)
- iter_group_labels
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels().apply_iter(lambda s: s.sum())) (-2, 8, 19, -2, 8)
- Series.iter_group_labels(depth_level).apply_iter_items(func)
- iter_group_labels
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels().apply_iter_items(lambda s: s.sum())) (('a', -2), ('b', 8), ('c', 19), ('d', -2), ('e', 8))
- Series.iter_group_labels(depth_level).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels
- 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels().apply_pool(func, use_threads=True) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_array(depth_level)
- iter_group_labels_array
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> tuple(s.iter_group_labels_array()) (array([10]), array([2]), array([8]))
- Series.iter_group_labels_array(depth_level).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_array().apply(lambda s: s.sum()) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_array(depth_level).apply_iter(func)
- iter_group_labels_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_array().apply_iter(lambda s: s.sum())) (-2, 8, 19, -2, 8)
- Series.iter_group_labels_array(depth_level).apply_iter_items(func)
- iter_group_labels_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_array().apply_iter_items(lambda s: s.sum())) (('a', -2), ('b', 8), ('c', 19), ('d', -2), ('e', 8))
- Series.iter_group_labels_array(depth_level).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_array
- 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_array().apply_pool(func, use_threads=True) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_array_items(depth_level)
- iter_group_labels_array_items
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> tuple(s.iter_group_labels_array_items()) (('a', array([10])), ('b', array([2])), ('c', array([8])))
- Series.iter_group_labels_array_items(depth_level).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_array_items().apply(lambda l, s: s.sum() if l != 8 else s.shape) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_array_items(depth_level).apply_iter(func)
- iter_group_labels_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_array_items().apply_iter(lambda l, s: s.sum() if l != 8 else -1)) (-2, 8, 19, -2, 8)
- Series.iter_group_labels_array_items(depth_level).apply_iter_items(func)
- iter_group_labels_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_array_items().apply_iter_items(lambda l, s: s.sum() if l != 8 else -1)) (('a', -2), ('b', 8), ('c', 19), ('d', -2), ('e', 8))
- Series.iter_group_labels_array_items(depth_level).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_array_items
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_array_items().apply_pool(func, use_threads=True) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_items(depth_level)
- iter_group_labels_items
>>> s = sf.Series((10, 2, 8), index=('a', 'b', 'c')) >>> tuple(s.iter_group_labels_items()) (('a', <Series> <Index> a 10 <<U1> <int64>), ('b', <Series> <Index> b 2 <<U1> <int64>), ('c', <Series> <Index> c 8 <<U1> <int64>))
- Series.iter_group_labels_items(depth_level).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_labels_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_items().apply(lambda l, s: s.sum() if l != 8 else s.shape) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_labels_items(depth_level).apply_iter(func)
- iter_group_labels_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_items().apply_iter(lambda l, s: s.sum() if l != 8 else -1)) (-2, 8, 19, -2, 8)
- Series.iter_group_labels_items(depth_level).apply_iter_items(func)
- iter_group_labels_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_labels_items().apply_iter_items(lambda l, s: s.sum() if l != 8 else -1)) (('a', -2), ('b', 8), ('c', 19), ('d', -2), ('e', 8))
- Series.iter_group_labels_items(depth_level).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_labels_items
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_labels_items().apply_pool(func, use_threads=True) <Series> <Index> a -2 b 8 c 19 d -2 e 8 <<U1> <int64>
- Series.iter_group_other(other, *, fill_value, axis)
- iter_group_other
Iterator of
Series
, grouped by unique values found in the passed container.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other(np.arange(len(s)) % 2)) (<Series> <Index> a -2 c 19 e 8 <<U1> <int64>, <Series> <Index> b 8 d -2 <<U1> <int64>)
- Series.iter_group_other(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other
Iterator of
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other(np.arange(len(s)) % 3).apply(lambda s: s.sum()) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_group_other(other, *, fill_value, axis).apply_iter(func)
- iter_group_other
Iterator of
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other(np.arange(len(s)) % 3).apply_iter(lambda s: s.sum())) (-4, 16, 19)
- Series.iter_group_other(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other
Iterator of
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other(np.arange(len(s)) % 3).apply_iter_items(lambda s: s.sum())) ((0, -4), (1, 16), (2, 19))
- Series.iter_group_other(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other
Iterator of
Series
, grouped by unique values found in the passed container.
- 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other(np.arange(len(s)) % 3).apply_pool(func, use_threads=True) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_group_other_array(other, *, fill_value, axis)
- iter_group_other_array
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array(np.arange(len(s)) % 2)) (array([-2, 19, 8]), array([ 8, -2]))
- Series.iter_group_other_array(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_array(np.arange(len(s)) % 3).apply(lambda s: s.sum()) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_group_other_array(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array(np.arange(len(s)) % 3).apply_iter(lambda s: s.sum())) (-4, 16, 19)
- Series.iter_group_other_array(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_array
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array(np.arange(len(s)) % 3).apply_iter_items(lambda s: s.sum())) ((0, -4), (1, 16), (2, 19))
- Series.iter_group_other_array(other, *, fill_value, axis).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_group_other_array
- 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.
>>> def func(s): return s.sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_array(np.arange(len(s)) % 3).apply_pool(func, use_threads=True) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_group_other_array_items(other, *, fill_value, axis)
- iter_group_other_array_items
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array_items(np.arange(len(s)) % 2)) ((0, array([-2, 19, 8])), (1, array([ 8, -2])))
- Series.iter_group_other_array_items(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_array_items(np.arange(len(s)) % 3).apply(lambda s: s.sum()) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.iter_group_other_array_items(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array_items(np.arange(len(s)) % 3).apply_iter(lambda s: s.sum())) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.iter_group_other_array_items(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_array_items
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_array_items(np.arange(len(s)) % 3).apply_iter_items(lambda s: s.sum())) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.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
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_array_items(np.arange(len(s)) % 3).apply_pool(func, use_threads=True) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_group_other_items(other, *, fill_value, axis)
- iter_group_other_items
Iterator of pairs of label,
Series
, grouped by unique values found in the passed container.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_items(np.arange(len(s)) % 2)) ((0, <Series> <Index> a -2 c 19 e 8 <<U1> <int64>), (1, <Series> <Index> b 8 d -2 <<U1> <int64>))
- Series.iter_group_other_items(other, *, fill_value, axis).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_group_other_items
Iterator of pairs of label,
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_items(np.arange(len(s)) % 3).apply(lambda s: s.sum()) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.iter_group_other_items(other, *, fill_value, axis).apply_iter(func)
- iter_group_other_items
Iterator of pairs of label,
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_items(np.arange(len(s)) % 3).apply_iter(lambda s: s.sum())) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.iter_group_other_items(other, *, fill_value, axis).apply_iter_items(func)
- iter_group_other_items
Iterator of pairs of label,
Series
, grouped by unique values found in the passed container.
- 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.
>>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_group_other_items(np.arange(len(s)) % 3).apply_iter_items(lambda s: s.sum())) TypeError('<lambda>() takes 1 positional argument but 2 were given')
- Series.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 pairs of label,
Series
, grouped by unique values found in the passed container.
- 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.
>>> def func(pair): return pair[1].sum() >>> s = sf.Series((-2, 8, 19, -2, 8), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_group_other_items(np.arange(len(s)) % 3).apply_pool(func, use_threads=True) <Series> <Index> 0 -4 1 16 2 19 <int64> <int64>
- Series.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment)
- iter_window
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window(size=3, step=1)) (<Series> <Index> a 2 b 8 c 19 <<U1> <int64>, <Series> <Index> b 8 c 19 d 34 <<U1> <int64>, <Series> <Index> c 19 d 34 e 54 <<U1> <int64>)
- Series.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window(size=3, step=1).apply(lambda s: s.sum()) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
- Series.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter(func)
- iter_window
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window(size=3, step=1).apply_iter(lambda s: s.sum())) (29, 61, 107)
- Series.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter_items(func)
- iter_window
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window(size=3, step=1).apply_iter_items(lambda s: s.sum())) (('c', 29), ('d', 61), ('e', 107))
- Series.iter_window(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window(size=3, step=1).apply_pool(lambda s: s.sum(), use_threads=True) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
- Series.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment)
- iter_window_array
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array(size=3, step=1)) (array([ 2, 8, 19]), array([ 8, 19, 34]), array([19, 34, 54]))
- Series.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_array
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_array(size=3, step=1).apply(lambda s: s.sum()) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
- Series.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter(func)
- iter_window_array
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array(size=3, step=1).apply_iter(lambda s: s.sum())) (29, 61, 107)
- Series.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter_items(func)
- iter_window_array
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array(size=3, step=1).apply_iter_items(lambda s: s.sum())) (('c', 29), ('d', 61), ('e', 107))
- Series.iter_window_array(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_array
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_array(size=3, step=1).apply_pool(lambda s: s.sum(), use_threads=True) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
- Series.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment)
- iter_window_array_items
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array_items(size=3, step=1)) (('c', array([ 2, 8, 19])), ('d', array([ 8, 19, 34])), ('e', array([19, 34, 54])))
- Series.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_array_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_array_items(size=3, step=1).apply(lambda l, s: s.sum() if l != 'd' else -1) <Series> <Index> c 29 d -1 e 107 <<U1> <int64>
- Series.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter(func)
- iter_window_array_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array_items(size=3, step=1).apply_iter(lambda l, s: s.sum() if l != 'd' else -1)) (29, -1, 107)
- Series.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter_items(func)
- iter_window_array_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_array_items(size=3, step=1).apply_iter_items(lambda l, s: s.sum() if l != 'd' else -1)) (('c', 29), ('d', -1), ('e', 107))
- Series.iter_window_array_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_array_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_array_items(size=3, step=1).apply_pool(lambda pair: pair[1].sum(), use_threads=True) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
- Series.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment)
- iter_window_items
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_items(size=3, step=1)) (('c', <Series> <Index> a 2 b 8 c 19 <<U1> <int64>), ('d', <Series> <Index> b 8 c 19 d 34 <<U1> <int64>), ('e', <Series> <Index> c 19 d 34 e 54 <<U1> <int64>))
- Series.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_window_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_items(size=3, step=1).apply(lambda l, s: s.sum() if l != 'd' else -1) <Series> <Index> c 29 d -1 e 107 <<U1> <int64>
- Series.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter(func)
- iter_window_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_items(size=3, step=1).apply_iter(lambda l, s: s.sum() if l != 'd' else -1)) (29, -1, 107)
- Series.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_iter_items(func)
- iter_window_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> tuple(s.iter_window_items(size=3, step=1).apply_iter_items(lambda l, s: s.sum() if l != 'd' else -1)) (('c', 29), ('d', -1), ('e', 107))
- Series.iter_window_items(*, size, axis, step, window_sized, window_func, window_valid, label_shift, start_shift, size_increment).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_window_items
- 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.
>>> s = sf.Series((2, 8, 19, 34, 54), index=('a', 'b', 'c', 'd', 'e')) >>> s.iter_window_items(size=3, step=1).apply_pool(lambda pair: pair[1].sum(), use_threads=True) <Series> <Index> c 29 d 61 e 107 <<U1> <int64>
Series: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib