Metadata-Version: 2.1
Name: ndindex
Version: 1.3
Summary: A Python library for manipulating indices of ndarrays.
Home-page: https://quansight.github.io/ndindex/
Author: Quansight
License: MIT
Description: # ndindex
        
        A Python library for manipulating indices of ndarrays.
        
        The documentation for ndindex can be found at https://quansight.github.io/ndindex/
        
        ndindex is a library that allows representing and manipulating objects that
        can be valid indices to numpy arrays, i.e., slices, integers, ellipses,
        None, integer and boolean arrays, and tuples thereof. The goals of the library
        are
        
        - Provide a uniform API to manipulate these objects. Unlike the standard index
          objects themselves like `slice`, `int`, and `tuple`, which do not share any
          methods in common related to being indices, ndindex classes can all be
          manipulated uniformly. For example, `idx.args` always gives the arguments
          used to construct `idx`.
        
        - Give 100% correct semantics as defined by numpy's ndarray. This means that
          ndindex will not make a transformation on an index object unless it is
          correct for all possible input array shapes. The only exception to this rule
          is that ndindex assumes that any given index will not raise IndexError (for
          instance, from an out of bounds integer index or from too few dimensions).
          For those operations where the array shape is known, there is a `reduce()`
          method to reduce an index to a simpler index that is equivalent for the
          given shape.
        
        - Enable useful transformation and manipulation functions on index objects.
        
        ## Examples
        
        **Canonicalize a slice**
        
        
        ```py
        >>> from ndindex import *
        >>> Slice(None, 10).reduce()
        Slice(0, 10, 1)
        ```
        
        **Compute the maximum length of a sliced axis**
        
        
        ```py
        >>> import numpy as np
        >>> len(Slice(2, 10, 3))
        3
        >>> len(np.arange(10)[2:10:3])
        3
        ```
        
        **Compute the shape of an array of shape `(10, 20)` indexed by `[0, 0:10]`**
        
        ```py
        >>> Tuple(0, slice(0, 10)).newshape((10, 20))
        (10,)
        >>> np.ones((10, 20))[0, 0:10].shape
        (10,)
        ```
        
        **Check if an indexed array would be empty**
        
        ```py
        >>> Tuple(0, ..., Slice(10, 20)).isempty((3, 4, 5))
        True
        >>> np.ones((3, 4, 5))[0,...,10:20]
        array([], shape=(4, 0), dtype=float64)
        ```
        
        See the [documentation](https://quansight.github.io/ndindex/) for full details
        on what ndindex can do.
        
        ## License
        
        [MIT License](LICENSE)
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
