Skip to main content

Efficient manipulation of the numpy structured arrays.

Project description

structured-array

PyPI - Version PyPI - Python Version codecov

Efficient manipulation of the numpy structured arrays.


Installation

pip install structured-array

Examples

A structured array can easily be created.

import structured_array as st

arr = st.array({
    "label": ["a", "b", "c"],
    "value": [4, 5, 6],
    "array": [np.zeros(3), np.ones(3), np.zeros(3)],
})
arr
label    value    array
[<U1]    [<i8]    [<f8]
-------  -------  ----------
a        4        (3,) array
b        5        (3,) array
c        6        (3,) array

You can directly read and write the structured array from/to a npy file.

arr = st.read_npy("data.npy")

structured-array use polars expression system to manipulate the structured array.

arr.select("label", st.col("value") + 1)  # column selection
arr.group_by("label").agg(st.col("value").sum())  # aggregation
arr.filter(st.col("value") > 5)  # filtering

License

structured-array is distributed under the terms of 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

structured_array-0.0.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

structured_array-0.0.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file structured_array-0.0.1.tar.gz.

File metadata

  • Download URL: structured_array-0.0.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for structured_array-0.0.1.tar.gz
Algorithm Hash digest
SHA256 68c7833d3b533e6a2f6161de87c18feada2e771f6c0a33eaac67d13408137ea5
MD5 4a81a9758270c233c47b9f8dfcc7f420
BLAKE2b-256 413c62ea276c89201736fb2dbdd745a3a85d75833675499d9703fb4f938159dc

See more details on using hashes here.

File details

Details for the file structured_array-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for structured_array-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7a75e67ac7134322b6521e994ec80489551834beee75f7f835031abf7222e3
MD5 1bde5827a14942798b914e1a88a577fc
BLAKE2b-256 edc3638b39c7d986252db967ef24dd6b1db83e487ea4f0d8861ec3e092eca531

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