Skip to main content

Time-proof Time-series Reduction Algorithm

TTRA is a lightweight algorithm reducing a time-series with a time omission.
It has been described in the Master's Thesis.

Example of real-time usage

animation

Usage

import pandas as pd
import matplotlib.pyplot as plt
from ttra import TTRA

# define minimal percentage change that should be detected by TTRA
PCT_CHANGE: float = 0.01
    
# let's take the inflation in Poland as an example
source: str = "https://stat.gov.pl/download/gfx/portalinformacyjny/pl/defaultstronaopisowa/4741/1/1/miesieczne_wskazniki_cen_towarow_i_uslug_konsumpcyjnych_od_1982_roku_13-05-2022.csv"
    
# download and process data
inflation = pd.read_csv(source,encoding='ISO-8859-2',sep=';').sort_values(['Rok','Miesišc'])
inflation = inflation[inflation['Sposób prezentacji'] == 'Analogiczny miesišc poprzedniego roku = 100']
inflation = inflation['Wartoœć'].dropna().map(lambda x: x.replace(',','.')).astype(float)
inflation = inflation.iloc[-12*25:].reset_index(drop=True) # last 25 years only to not obscure the newest data

# initiate TTRA and reduce data with a given PCT_CHANGE
tr = TTRA(inflation)
reduced = tr.reduce(PCT_CHANGE)

# plot data, reduced data and an assumption of the current extremum
fig, ax = plt.subplots()
inflation.plot(ax=ax)
reduced.plot(ax=ax)
plt.scatter(tr.a.Index, tr.a.x, s= 150 , color='black')

Output

image

Metadata

Release files for ttra 0.1.1

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

Source distribution (sdist)

Source distribution for ttra 0.1.1
File Size Uploaded Provenance Actions
ttra-0.1.1.tar.gz 3.7 kB Without provenance Details for ttra-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ttra 0.1.1
File Interpreter ABI Platform Actions
ttra-0.1.1-py3-none-any.whl Python 3 none any Details for ttra-0.1.1-py3-none-any.whl

Total release size: 7.6 kB

Release files / ttra-0.1.1.tar.gz

Download URL ttra-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fab3822c6d2aa5aa6da766a231bd3b38ae772f639481e70b408b682b635eea91
BLAKE2b-256 checksum
How to use checksums
c397c5a8318e0c8fb2af4c748b18d697e52ec3aee53d827ee2da8c2deefaa868
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release files / ttra-0.1.1-py3-none-any.whl

Download URL ttra-0.1.1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7d2ebe2d08852cde9be775afe537c55b13dad1c0b4798aecd39e4eb4e2458d6
BLAKE2b-256 checksum
How to use checksums
c5596151fadbc1b048a8e97d14c57fbccc09a9b544d15dab6e9309960a61f07f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Security for ttra 0.1.1

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