Implementation of Time-proof Time-series Reduction Algorithm
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
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.reduce(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
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.7.tar.gz
(3.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ttra-0.0.7-py3-none-any.whl
(3.9 kB
view details)
File details
Details for the file ttra-0.0.7.tar.gz.
File metadata
- Download URL: ttra-0.0.7.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f682953f4cadfe097490a3713ea255845c8c2eef2d0bf89c7640ae88d898bb17
|
|
| MD5 |
b09c3e18f2f7ed1851ec8a9986070cfa
|
|
| BLAKE2b-256 |
34c6d7fb869412374a87de672f488d18df0e8f6194be420d5b27ed4a3a6b4276
|
File details
Details for the file ttra-0.0.7-py3-none-any.whl.
File metadata
- Download URL: ttra-0.0.7-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b85e6cc130990a45687d6ba268508d15d184cd550f988dc12383238e69e9d29f
|
|
| MD5 |
afc43585dd83bb14f9cd20336b2bdb9e
|
|
| BLAKE2b-256 |
8ac818fafc097591bb72986aa22bc3c7f67a11cd70ea697c047ca408c74203dd
|