Skip to main content

Float and custom indexes in Python

Project description

fidx

A module for float and custom indexes in Python

Allows to use float indexes to access lists, tuples, … in percentage (e.g. 0.5 is the middle item).
Allows also to add custom index types to existing types or to custom ones.

Installation

pip install fidx

Usage example

>>> import fidx

>>> fidx([1,2,3])[.5]
2

>>> l = fidx([1,2,3,4])
>>> l[:.5], l[.5:]
([1, 2], [3, 4])

>>> t = fidx.tuple(i//2 for i in range(0,10))
>>> t[.2:-.2:.2]
(1, 2, 3)

For more examples and usage, please refer to the Wiki.

About

Davide Peressoni – dpdmancul+fidx@gmail.com

Distributed under the MIT license. See LICENSE for more information.

https://gitlab.com/DPDmancul/

Changelog

  • version 1.1.0

    • Fix of #1
    • Added float_id method to extended classes.
    • Added fidx.float_idx_of function.
  • version 1.1.1 and 1.1.2

    • Better support for NumPy indexes.

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

fidx-1.1.2.tar.gz (5.9 kB view hashes)

Uploaded Source

Supported by

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