Lightweight Vector/Column/DataFrame utilities
Project description
vecly
Lightweight, NumPy-backed building blocks for quick finance/research workflows.
vecly provides three small primitives:
Vector: a thin wrapper aroundnumpy.ndarraywith operator overloading and basic stats.Column: a named 1D series-like object built onVector.DataFrame: a minimal column container for quick prototyping and feature workflows.
The goal is fast iteration: get just enough structure for experiments (ML/finance/research) without pulling in a full dataframe framework.
Install
From PyPI:
python -m pip install vecly
For local development:
python -m pip install -e .
Quickstart
import numpy as np
from vecly import Vector, Column, DataFrame
# Vector: NumPy-friendly wrapper
v = Vector([1, 2, 3])
print(v + 2) # Vector([3 4 5])
print(v.mean()) # 2.0
print(np.log(v)) # works via NumPy interop
# Column: named vector
price = Column("price", [100, 101, 103, 102])
# Simple feature workflow (returns -> log-returns)
ret = price / price.shift(1) - 1
log_ret = ret.log()
df = DataFrame([price])
df.append(Column("ret", ret))
df.append(Column("log_ret", log_ret))
print(df) # pretty preview
print(df["price"]) # -> 1D np.ndarray
print(df[["ret", "log_ret"]]) # -> 2D np.ndarray (n_rows, 2)
Core API
Vector
- Construction:
Vector(data) - Underlying array:
v.dataorv.to_numpy() - Math:
+ - * / **(elementwise; supports scalars, array-likes, otherVector) - Stats:
v.sum(),v.mean(),v.var(),v.std() - Transforms:
v.log()→ returns a newVectorv.shift(n=1, fill_value=np.nan)→ returns a newVector
- NumPy interop:
np.asarray(v),np.log(v),np.column_stack([v1, v2]), etc.
Column
- Construction:
Column(name, x)wherexcan be list/ndarray/Vector - Name:
col.name - Data:
col.vec(Vector) orcol.to_numpy()(np.ndarray) - Transforms:
col.shift(n=1)→Vectorcol.log()→Vector
- Elementwise math:
col / other(whereothercan beColumn,Vector, scalar, array-like) →Vector
DataFrame
DataFrame is intentionally minimal: it stores a list of Column objects.
- Construction:
DataFrame([Column(...), ...]) - Append/replace column:
df.append(col)(replaces if samecol.name) - Add from raw data:
df.add_col(name, data) - Select:
df["x"]→ 1Dnp.ndarraydf[["x", "y"]]→ 2Dnp.ndarrayshaped(n_rows, 2)
License
MIT. See 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 vecly-0.1.1.tar.gz.
File metadata
- Download URL: vecly-0.1.1.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e8e438d1aee862cee3bc3c29631a0df48ac3bfa3170f816dbdacf5f6292550d
|
|
| MD5 |
04abcec6f1167f1244ad768a69ab8a33
|
|
| BLAKE2b-256 |
a97c7a8d0bf453a855b8e022efa4cc6a7547f2e5624c116d7646d3a78cb18af3
|
File details
Details for the file vecly-0.1.1-py3-none-any.whl.
File metadata
- Download URL: vecly-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55b48b3106b702d8cc9606fecc2b7b19f77b01bed74578241683eb4b608577de
|
|
| MD5 |
5f53631708ec77cfdd4eece9fe2d7af0
|
|
| BLAKE2b-256 |
3f63d17467f24dbc3117f02097e16d5354d85adfe88843f6bea6c0c875e6d3eb
|