A lightweight wrapper around numpy arrays for DataFrame-like functionality
Project description
NumpyFrame
A lightweight wrapper around numpy arrays that provides DataFrame-like functionality with minimal dependencies.
Features
- Column Selection: Access columns by name (O(1) lookup).
- Indexing & Slicing:
nf["col"]-> 1D arraynf[["col1", "col2"]]-> Sub-framenf[0:5]-> Row slicenf[[0, 2], ["a", "b"]]-> Advanced rectangular indexing (Train/Test split friendly!)
- GroupBy: Split-Apply-Combine with
.groupby("col").mean()or.sum(). - Fast: Built purely on top of numpy.
Installation
pip install numpy_frame
Usage
import numpy as np
from numpy_frame import NumpyFrame
# Create data
data = np.arange(12).reshape(4, 3)
cols = ["a", "b", "c"]
nf = NumpyFrame(data, cols)
# 1. Column Access
print(nf["a"])
# 2. Slicing
subset = nf[:2, ["a", "c"]]
# 3. Advanced Indexing (e.g. random rows)
random_rows = [0, 3]
train_set = nf[random_rows, ["a", "b"]]
# 4. GroupBy
# Suppose column 'a' has groups
nf_grouped = nf.groupby("a").sum()
print(nf_grouped)
License
MIT
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
numpy_frame-0.1.0.tar.gz
(23.9 kB
view details)
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 numpy_frame-0.1.0.tar.gz.
File metadata
- Download URL: numpy_frame-0.1.0.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aa524863c7f8f8a81b599a737ca740dc00a19b0a16bdf45a56ae01bbfa59035
|
|
| MD5 |
d09fe4f4ece2297cc4ae757ba9568222
|
|
| BLAKE2b-256 |
c6ffbed29f5cef941f512bb4c1408c208440fa700606a4c6afca6e9e8e6070dc
|
File details
Details for the file numpy_frame-0.1.0-py3-none-any.whl.
File metadata
- Download URL: numpy_frame-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49cf4b9a7091c81cd8ef4dd59d251fd652c3dfa8c5c769739789d0b0a89d5391
|
|
| MD5 |
91204ab66ed2dd23e2e5c7b63a78e0bb
|
|
| BLAKE2b-256 |
34b017a54b39538220fc8ce78e06baab9c7b0e9edcd0af2cc3ebac410718286b
|