Introduction
Abstract
An awesome tool for indexing matrices. propose a new concept “single index” (as in matlab) to index the elements from matrices. exchange python-style index(begin with 0) with matlab-style index(begin with 1)
Keywords
Index, Matrix, Single Index, Style of Index
New feature:
fix some bugs
Feature:
propose single index
change to (back from) matlab-style index
arithmetic of the index
Content
Classes:
SingleIndex: wrapper of int, list, slice Index: array of SingleIndex
Interface:
Arith: arithmetic of index
function:
irange: interval-like index
Grammar
Basic grammar
import:
import pindex # python for index
Example:
ind = SingleIndex([1,2,3]) # construct a single index
s = ind('helloworld') # index(array) == array[index]
print(s)
A = np.array([[1,2,6],[3,4,5]])
B = ind(A)
print(B) # index matrix with single index as in matlab
ind.py2matlab() # change to matlab style
s = ind('helloworld')
print(s) # output: hel
ind = Index([1,2,3]) # for 1dim array, Index == SingleIndex
ss = ind('helloworld')
print(ss)
ind = Index(([1,2],[3,4])) # construct multi-index
try:
ss = ind(['hello', 'world'])
print(ss)
except:
ind.py2matlab()
ss = ind(['hello', 'world'])
print(ss)
Attention:
ind = SingleIndex([1,2,3]) A = [[1,2,6],[3,4,5]] B = ind(A) # pindex.py thinks A is a list (of lists, with length 2) instead of matrix ind = Index(([0,1],[0,1])) # this is ok, since you use multi-index
Metadata
Release files for pindex 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pindex-0.5.1.tar.gz | 5.0 kB | Without provenance | Details for pindex-0.5.1.tar.gz |
Release files / pindex-0.5.1.tar.gz
| Download URL | pindex-0.5.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9f30b6603f982e5739f14afb8e0a15f448d505081c51387d335b402c5d77241
|
|
BLAKE2b-256 checksum How to use checksums |
ec9cbad05f469f68617a500e17c20eea99835552506c1ce50ca24fee2a3c0b3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
|
Security for pindex 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.