Detail: IndexNanosecond: Iterator
Overview: IndexNanosecond: Iterator
- IndexNanosecond.iter_label(depth_level)
- iter_label
>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09')) >>> ix <IndexNanosecond> 1789-05-05T00:00:00.000000000 1789-12-31T00:00:00.000000000 1799-11-09T00:00:00.000000000 <datetime64[ns]> >>> tuple(ix.iter_label()) (numpy.datetime64('1789-05-05T00:00:00.000000000'), numpy.datetime64('1789-12-31T00:00:00.000000000'), numpy.datetime64('1799-11-09T00:00:00.000000000'))
- IndexNanosecond.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.
>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09')) >>> ix <IndexNanosecond> 1789-05-05T00:00:00.000000000 1789-12-31T00:00:00.000000000 1799-11-09T00:00:00.000000000 <datetime64[ns]> >>> ix.iter_label().apply(lambda l: l.astype('<M8[ms]').astype(object).year) [1789 1789 1799]
- IndexNanosecond.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.
>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09')) >>> ix <IndexNanosecond> 1789-05-05T00:00:00.000000000 1789-12-31T00:00:00.000000000 1799-11-09T00:00:00.000000000 <datetime64[ns]> >>> tuple(ix.iter_label().apply_iter(lambda l: l.astype('<M8[ms]').astype(object))) (datetime.datetime(1789, 5, 5, 0, 0), datetime.datetime(1789, 12, 31, 0, 0), datetime.datetime(1799, 11, 9, 0, 0))
- IndexNanosecond.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.
>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09')) >>> ix <IndexNanosecond> 1789-05-05T00:00:00.000000000 1789-12-31T00:00:00.000000000 1799-11-09T00:00:00.000000000 <datetime64[ns]> >>> tuple(ix.iter_label().apply_iter_items(lambda l: l.astype('<M8[ms]').astype(object))) ((0, datetime.datetime(1789, 5, 5, 0, 0)), (1, datetime.datetime(1789, 12, 31, 0, 0)), (2, datetime.datetime(1799, 11, 9, 0, 0)))
- IndexNanosecond.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.
>>> ix = sf.IndexNanosecond(('1789-05-05', '1789-12-31', '1799-11-09')) >>> ix <IndexNanosecond> 1789-05-05T00:00:00.000000000 1789-12-31T00:00:00.000000000 1799-11-09T00:00:00.000000000 <datetime64[ns]> >>> ix.iter_label().apply_pool(lambda l: l.astype('<M8[ms]').astype(object).month, use_threads=True) [ 5 12 11]
IndexNanosecond: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic