Skip to main content

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 around numpy.ndarray with operator overloading and basic stats.
  • Column: a named 1D series-like object built on Vector.
  • 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.data or v.to_numpy()
  • Math: + - * / ** (elementwise; supports scalars, array-likes, other Vector)
  • Stats: v.sum(), v.mean(), v.var(), v.std()
  • Transforms:
    • v.log() → returns a new Vector
    • v.shift(n=1, fill_value=np.nan) → returns a new Vector
  • NumPy interop:
    • np.asarray(v), np.log(v), np.column_stack([v1, v2]), etc.

Column

  • Construction: Column(name, x) where x can be list/ndarray/Vector
  • Name: col.name
  • Data: col.vec (Vector) or col.to_numpy() (np.ndarray)
  • Transforms:
    • col.shift(n=1)Vector
    • col.log()Vector
  • Elementwise math:
    • col / other (where other can be Column, 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 same col.name)
  • Add from raw data: df.add_col(name, data)
  • Select:
    • df["x"] → 1D np.ndarray
    • df[["x", "y"]] → 2D np.ndarray shaped (n_rows, 2)

License

MIT. See 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

vecly-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vecly-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for vecly-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6e8e438d1aee862cee3bc3c29631a0df48ac3bfa3170f816dbdacf5f6292550d
MD5 04abcec6f1167f1244ad768a69ab8a33
BLAKE2b-256 a97c7a8d0bf453a855b8e022efa4cc6a7547f2e5624c116d7646d3a78cb18af3

See more details on using hashes here.

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

Hashes for vecly-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55b48b3106b702d8cc9606fecc2b7b19f77b01bed74578241683eb4b608577de
MD5 5f53631708ec77cfdd4eece9fe2d7af0
BLAKE2b-256 3f63d17467f24dbc3117f02097e16d5354d85adfe88843f6bea6c0c875e6d3eb

See more details on using hashes here.

Supported by

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