Skip to main content

A lightweight, dictionary-based DataFrame implementation in pure Python. Designed for simplicity and ease of use. Perfect for small projects or when a full-fledged DataFrame library is overkill.

Project description

Lontras

Lontras Logo

PyPI - Version PyPI - Python Version License: MIT GitHub Actions Workflow Status Codecov CodeFactor Grade


⚠️ This library is under development and has not been released yet

We love pandas and its siblings! They're the industry-standard tools for powerful data manipulation. However, for smaller projects or when minimizing dependencies is paramount, lontras offers a lightweight, pure-Python alternative built on simple dictionaries. Designed for ease of use and direct integration, lontras encourages you to copy and paste its core components into your code. It's the perfect stand mixer for baking smaller data tasks when bringing out the full industrial equipment of pandas is too much.

TLDR;

  • Small-scale DataFrame operations? lontras!
  • Fast DataFrame loading, no dependencies? lontras!
  • Embed DataFrames in MicroPython? lontras!
  • Use DataFrames in the browser (PyScript)? lontras!
  • High Pandas compatibility? lontras!

Table of Contents

Installation

If you prefer to install lontras using pip for easy management and updates, you can do so with the following command:

pip install lontras
# or
uv pip install lontras

This will download and install lontras from the Python Package Index (PyPI).

For lightweight projects where you want to avoid external dependencies, you can simply copy the source file src/lontras/lontras.py into your project directory. This allows you to directly use the library functions from your code without any installation.

Documentation

Check out the API Docs at: ...

Core Functionalities:

Lontras prioritizes simplicity and minimal dependencies. It leverages Python's native dictionaries (via UserDict) to offer core DataFrame and Series functionalities without external libraries.

Data Structures:

  • Series: A one-dimensional array-like structure.
  • DataFrame: A two-dimensional labeled data structure.

Accessing Data:

  • loc and iloc: Access data by label or by index.
  • Label-based access: Access data using standard dictionary-like syntax (e.g., series['label']).
  • Positional access (slicing): Use slices for location-based access (e.g., series[1:3]).
  • Attribute-based access: For convenient access to all values for a given key, use attribute-based access using getattr that dynamically retrieves data based on provided keys or a list of keys.

Modifying Data:

  • Setting values: Modify existing values or add new entries using loc or iloc assignment (e.g., series.loc['label'] = value).
  • Deleting values: Remove entries using del series['label'].
  • Concatenation: Combine Series or DataFrames vertically or horizontally.

Transforming Data:

  • Mapping and applying functions: Apply functions element-wise using map or along axes/indices using apply.
  • Sorting: Sort indexes and values using provided sorting functions.
  • Basic operations: Use standard Python operators (+, -, *, /, //, %, **, comparisons) for element-wise operations.

Data Aggregation and Combination:

  • groupby: Group data based on a column and perform operations within each group (similar to pandas groupby).
  • Join/Merge: Merge two DataFrames based on specific columns (similar to pandas join/merge operations).
  • reduce: Apply a function cumulatively to the elements. Basic reduction functions like max, min, argmax, sum, etc.
  • Leverages Python's built-in statistics module for basic statistical calculations.

Limitations & Trade-offs: (Same as before)

  • Specialized Data Handling: Lontras focuses on core functionalities and doesn't include specialized functions for datetime, strings, or categorical data. However, users can achieve similar behavior through apply and map functions.
  • Statistical Functions: Limited set of statistical functions. Lontras relies primarily on Python's built-in statistics module.
  • Data Import/Export: Supports limited import/export formats. External libraries might be necessary for complex file handling.
  • Missing Data Handling: Doesn't include dedicated functions for handling missing data. Users can implement their own logic using conditional statements or filtering.
  • Multilevel Indexing: Lacks built-in support for multilevel indexing. However, tuple indexes can be used to achieve similar hierarchical structures.
  • Plotting: Currently doesn't include plotting functionalities. External plotting libraries are recommended for visualization.

License

lontras 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

lontras-0.0.1.tar.gz (369.1 kB view details)

Uploaded Source

Built Distribution

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

lontras-0.0.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lontras-0.0.1.tar.gz
  • Upload date:
  • Size: 369.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lontras-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bf55434e8f7b4140cdfde3de1ad208545c49ff07d084e47590975a5b4c8345bd
MD5 8f03b6851dbfbda1fc9048135b30bc1e
BLAKE2b-256 1ebfc7818bf1e0edd5146afd45fbb078e2d6663ede0b2ef067385b22b9b15885

See more details on using hashes here.

Provenance

The following attestation bundles were made for lontras-0.0.1.tar.gz:

Publisher: publish.yml on luxedo/lontras

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: lontras-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lontras-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5297445c6015c2c442c141aabf2adc4f88cf9ff5b8a6b6ca45f7966609b3616
MD5 371722981d4469d0d2e7c3de534d9258
BLAKE2b-256 42fff217a2d87f65e795a76d4554ede3a23661e09937da6964379ac747e4bdcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for lontras-0.0.1-py3-none-any.whl:

Publisher: publish.yml on luxedo/lontras

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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