Detail: IndexHierarchyGO: Iterator
Overview: IndexHierarchyGO: Iterator
- IndexHierarchyGO.iter_label(depth_level)
- iter_label
>>> ih = sf.IndexHierarchyGO.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x') >>> ih <IndexHierarchyGO: x> a 1024 a 4096 a 2048 b 1024 b 4096 b 2048 c 1024 c 4096 c 2048 <<U1> <int64> >>> tuple(ih.iter_label()) (('a', 1024), ('a', 4096), ('a', 2048), ('b', 1024), ('b', 4096), ('b', 2048), ('c', 1024), ('c', 4096), ('c', 2048))
- IndexHierarchyGO.iter_label(depth_level).apply(func, *, dtype, name, index_constructor, columns_constructor)
- iter_label
- 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.
>>> ih = sf.IndexHierarchyGO.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x') >>> ih <IndexHierarchyGO: x> a 1024 a 4096 a 2048 b 1024 b 4096 b 2048 c 1024 c 4096 c 2048 <<U1> <int64> >>> ih.iter_label().apply(lambda l: (l[0].upper(), l[1])) [('A', 1024) ('A', 4096) ('A', 2048) ('B', 1024) ('B', 4096) ('B', 2048) ('C', 1024) ('C', 4096) ('C', 2048)]
- IndexHierarchyGO.iter_label(depth_level).apply_iter(func)
- iter_label
- 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.
>>> ih = sf.IndexHierarchyGO.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x') >>> ih <IndexHierarchyGO: x> a 1024 a 4096 a 2048 b 1024 b 4096 b 2048 c 1024 c 4096 c 2048 <<U1> <int64> >>> tuple(ih.iter_label().apply_iter(lambda l: (l[0].upper(), l[1]))) (('A', 1024), ('A', 4096), ('A', 2048), ('B', 1024), ('B', 4096), ('B', 2048), ('C', 1024), ('C', 4096), ('C', 2048))
- IndexHierarchyGO.iter_label(depth_level).apply_iter_items(func)
- iter_label
- 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.
>>> ih = sf.IndexHierarchyGO.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x') >>> ih <IndexHierarchyGO: x> a 1024 a 4096 a 2048 b 1024 b 4096 b 2048 c 1024 c 4096 c 2048 <<U1> <int64> >>> tuple(ih.iter_label().apply_iter_items(lambda l: (l[0].upper(), l[1]))) ((0, ('A', 1024)), (1, ('A', 4096)), (2, ('A', 2048)), (3, ('B', 1024)), (4, ('B', 4096)), (5, ('B', 2048)), (6, ('C', 1024)), (7, ('C', 4096)), (8, ('C', 2048)))
- IndexHierarchyGO.iter_label(depth_level).apply_pool(func, *, dtype, name, index_constructor, max_workers, chunksize, use_threads)
- iter_label
- 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.
>>> ih = sf.IndexHierarchyGO.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x') >>> ih <IndexHierarchyGO: x> a 1024 a 4096 a 2048 b 1024 b 4096 b 2048 c 1024 c 4096 c 2048 <<U1> <int64> >>> ih.iter_label().apply_pool(lambda l: (l[0].upper(), l[1]), use_threads=True) [('A', 1024) ('A', 4096) ('A', 2048) ('B', 1024) ('B', 4096) ('B', 2048) ('C', 1024) ('C', 4096) ('C', 2048)]
IndexHierarchyGO: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic