Efficient manipulation of the numpy structured arrays.
Project description
structured-array
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68c7833d3b533e6a2f6161de87c18feada2e771f6c0a33eaac67d13408137ea5
|
|
| MD5 |
4a81a9758270c233c47b9f8dfcc7f420
|
|
| BLAKE2b-256 |
413c62ea276c89201736fb2dbdd745a3a85d75833675499d9703fb4f938159dc
|
File details
Details for the file structured_array-0.0.1-py3-none-any.whl.
File metadata
- Download URL: structured_array-0.0.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7a75e67ac7134322b6521e994ec80489551834beee75f7f835031abf7222e3
|
|
| MD5 |
1bde5827a14942798b914e1a88a577fc
|
|
| BLAKE2b-256 |
edc3638b39c7d986252db967ef24dd6b1db83e487ea4f0d8861ec3e092eca531
|