Skip to main content
logo.png

Python Project tslist

GitHubWorkflow Read the Docs GitHub GitHub release PyPI Version PyPI - Python Version PyPI Downloads

Introduction

To import the project simply type

>>> import tslist

after installation.

The TS filtered list enhances the standard list by filtering the list by slices of types T differing from int in which (before comparision) any item x is converted to type T by calling T(x)

>>> from tslist import TSList
>>> l = 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9
>>> tsl = TSList(l)
>>> tsl
TSList([1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
>>> tsl[1.0:1.3]  # filter all items between 1.0 (included) and 1.3 (excluded)
TSList([1.0, 1.1, 1.2])
>>> tsl[1.0:1.31]
TSList([1.0, 1.1, 1.2, 1.3])
>>> tsl[1.1]  # filter all items at 1.1
TSList([1.1])
>>> tsl.append(1.1)
>>> tsl[1.1]
TSList([1.1, 1.1])

This becomes even more handy if list items admit conversions.

>>> from datetime import timedelta, datetime
>>> from tslist import TS
>>> class Timedelta(timedelta):
...     def __float__(self):
...         return self.total_seconds()
...
...     def __ts__(self):
...         # used for conversion using tslist.TS
...         return datetime(2000, 1, 1) + self
>>> l = [Timedelta(d) for d in range(10, 15)]
>>> tsl = TSList(l)
>>> tsl
TSList(
[ Timedelta(days=10),
  Timedelta(days=11),
  Timedelta(days=12),
  Timedelta(days=13),
  Timedelta(days=14)]
)
>>> list(map(float, tsl))
[864000.0, 950400.0, 1036800.0, 1123200.0, 1209600.0]
>>> tsl[950400.:1209600.:2]
TSList([Timedelta(days=11), Timedelta(days=13)])
>>> list(map(TS, tsl))
[TS(20000111), TS(20000112), TS(20000113), TS(20000114), TS(20000115)]
>>> tsl[TS(20000112):TS(20000114)]
TSList([Timedelta(days=11), Timedelta(days=12)])

See TS() for more detail on timestamp and datetime conversion.

Documentation

More docs can be found on https://tslist.readthedocs.io

Install

The latest stable version can always be installed or updated via pip:

$ pip install tslist

License

Code and documentation are available according to the license (see LICENSE file in repository).

Metadata

Release files for tslist 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tslist 0.3.4
File Size Uploaded Provenance Actions
tslist-0.3.4.zip 28.1 kB Without provenance Details for tslist-0.3.4.zip

Release files / tslist-0.3.4.zip

Download URL tslist-0.3.4.zip
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9844d1f021b3fca851b05ac59c668a4997f5393c4f8603b51dd10ac557d6e013
BLAKE2b-256 checksum
How to use checksums
f4f9c0eb81868af601629e7a3c9c2cd66c6d1a89d1583774a5ca8a380f3b9c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.11

Security for tslist 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page