Trend Detection in Python. Applicable for real-world industry use cases in time series.
Project description
PyTrendy is a robust solution for identifying and analyzing trends in time series. Unlike other trend detection packages, it is robust to noisy & flat segments, and handles for gradual & abrupt trend cases with a high precision. It aims to be the best package for trend detection in python.
Features
Quickstart
Install the package from PyPi.
pip install pytrendy
Import pytrendy, and apply trend detection on daily time series data.
import pytrendy as pt
df = pt.load_data('series_synthetic')
results = pt.detect_trends(df, date_col='date', value_col='gradual', plot=True)
results.print_summary()
Detected:
- 3 Uptrends.
- 3 Downtrends.
- 3 Flats.
- 0 Noise.
The best detected trend is Down between dates 2025-05-09 - 2025-06-17
Full Results:
-------------------------------------------------------------------------------
direction start end days total_change change_rank trend_class
time_index
1 Up 2025-01-02 2025-01-24 22 14.013348 5 gradual
2 Down 2025-01-25 2025-02-05 11 -13.564214 6 gradual
3 Flat 2025-02-06 2025-02-09 3 -1.168831 9 NaN
4 Up 2025-02-10 2025-03-14 32 24.632035 3 gradual
5 Flat 2025-03-15 2025-03-17 2 5.660173 7 NaN
6 Down 2025-03-18 2025-04-01 14 -22.721861 4 gradual
7 Up 2025-04-02 2025-05-08 36 72.611833 2 gradual
8 Down 2025-05-09 2025-06-17 39 -73.253968 1 gradual
9 Flat 2025-06-18 2025-06-30 12 3.910534 8 NaN
-------------------------------------------------------------------------------
Read more in the full documentation: russellsb.github.io/pytrendy/main
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file pytrendy-1.2.0.dev1.tar.gz.
File metadata
- Download URL: pytrendy-1.2.0.dev1.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17b21880a12f42c725e8bea348cca1da50ba82d99cd713d0a50e847cc4134ff5
|
|
| MD5 |
a3e7fa3ab4fa699abaa45d76a51809b2
|
|
| BLAKE2b-256 |
95ed33de69a828d409825c07385029518b0166dbb00420f9ee6f0fdc48ed106a
|
Provenance
The following attestation bundles were made for pytrendy-1.2.0.dev1.tar.gz:
Publisher:
release.yaml on RussellSB/pytrendy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytrendy-1.2.0.dev1.tar.gz -
Subject digest:
17b21880a12f42c725e8bea348cca1da50ba82d99cd713d0a50e847cc4134ff5 - Sigstore transparency entry: 1453864960
- Sigstore integration time:
-
Permalink:
RussellSB/pytrendy@35f25fce307fae2f3303bd6ec4a60d309ec297a7 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/RussellSB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@35f25fce307fae2f3303bd6ec4a60d309ec297a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytrendy-1.2.0.dev1-py3-none-any.whl.
File metadata
- Download URL: pytrendy-1.2.0.dev1-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0a41443ef4f2b1e8f692ab682637b0a2479257bdf5d73bba3427160f8853c60
|
|
| MD5 |
9d0f42bc9331612a5743bd2b847b12ed
|
|
| BLAKE2b-256 |
88c39d143069e3e166c02ef9c505d0f80ae06fe89c78107f9970028e88489055
|
Provenance
The following attestation bundles were made for pytrendy-1.2.0.dev1-py3-none-any.whl:
Publisher:
release.yaml on RussellSB/pytrendy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytrendy-1.2.0.dev1-py3-none-any.whl -
Subject digest:
e0a41443ef4f2b1e8f692ab682637b0a2479257bdf5d73bba3427160f8853c60 - Sigstore transparency entry: 1453865050
- Sigstore integration time:
-
Permalink:
RussellSB/pytrendy@35f25fce307fae2f3303bd6ec4a60d309ec297a7 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/RussellSB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@35f25fce307fae2f3303bd6ec4a60d309ec297a7 -
Trigger Event:
push
-
Statement type: