Skip to main content

Some useful extensions for NumPy

Project description

npx

PyPi Version PyPI pyversions GitHub stars PyPi downloads

gh-actions codecov LGTM Code style: black

NumPy is a large library used everywhere in scientific computing. That's why breaking backwards-compatibility is comes as a significant cost and is almost always avoided, even if the API of some methods is arguably confusing. This package provides drop-in wrappers "fixing" those.

If you have a fix for a NumPy method that can't go upstream for some reason, feel free to PR here.

  • npx.dot(a, b)
    

    Forms the dot product between the last axis of a and the first axis of b.

    (Not the second-last axis of b as numpy.dot(a, b).)

  • npx.solve(A, b)
    

    Solves a linear equation system with a matrix of shape (n, n) and an array of shape (n, ...). The output has the same shape as the second argument.

  • npx.sum_at(a, idx, minlength: int = 0)
    npx.add_at(out, idx, a)
    

    Returns an array with entries of a summed up at indices idx with a minumum length of minlength. idx can have any shape as long as it's matching a. The output shape is (minlength,...).

    The numpy equivalent numpy.add.at is much slower:

    memory usage

    (See also this numpy bug.)

  • npx.unique_rows(a, return_inverse=False, return_counts=False)
    

    Returns the unique rows of the array a. The numpy alternative np.unique(a, axis=0) is slow.

License

npx is published under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npx-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

npx-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file npx-0.0.2.tar.gz.

File metadata

  • Download URL: npx-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for npx-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a7f635706659451bc5987f7be40601da9e39ebf87173783300cb608ec7269d57
MD5 b176bc10945b52f0ba513ca617852ff2
BLAKE2b-256 6eb0707888859758eeb1fce2d3e00431d91d4d764eb1966324ca610b58efd4d5

See more details on using hashes here.

File details

Details for the file npx-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: npx-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for npx-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3de38b66a245c38f03d01094c96e194e94c5f0c7b88bc62ea48c93bfa9d28279
MD5 a13a24b29716928ed11bb131381552de
BLAKE2b-256 e64aae11d34077b31219e83e2bbf01e4b48e10229566224744360193e9e7a3d7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page