Skip to main content

Implementation of

Project description

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

Installation

pip install -i https://test.pypi.org/simple/ ttra

Usage

import pandas as pd
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.run(PCT_CHANGE).x

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

Output

image

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

ttra-0.0.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

ttra-0.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file ttra-0.0.4.tar.gz.

File metadata

  • Download URL: ttra-0.0.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.8

File hashes

Hashes for ttra-0.0.4.tar.gz
Algorithm Hash digest
SHA256 271dea6f2102c7ba8aa695c1e9824f3cb1b84ced5ab129c76dabf13f0631a010
MD5 2d9ebd4e50bf00511b78445c78359e77
BLAKE2b-256 ae2b2785879212ada73dcdd6d182d86fe5a71fffff38d88e372ec3e58d4d2b0c

See more details on using hashes here.

File details

Details for the file ttra-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: ttra-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.8

File hashes

Hashes for ttra-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 83cc9203257ad5cbca271cd395b503fdc1f55485edf4230bebc9a10ec81fe070
MD5 978d1d2e51a7a0f0ef7c499e5583ba4f
BLAKE2b-256 4e2b089c6a622711e3be88048cbf642c353f1ff5a7a9cf3240bbbe7cb6b35971

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