Skip to main content

Trend Detection in Python. Applicable for real-world industry use cases in time series.

Project description

PyTrendy Logo

PyTrendy

PyPI version Python License: MIT
Tests Release
codecov Downloads

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
time_index                                                                   
1                 Up  2025-01-02  2025-01-24    22     14.013348            5
2               Down  2025-01-25  2025-02-05    11    -13.564214            6
3               Flat  2025-02-06  2025-02-09     3           NaN            7
4                 Up  2025-02-10  2025-03-14    32     24.632035            3
5               Flat  2025-03-15  2025-03-17     2           NaN            8
6               Down  2025-03-18  2025-04-01    14    -22.721861            4
7                 Up  2025-04-02  2025-05-08    36     72.611833            2
8               Down  2025-05-09  2025-06-17    39    -73.253968            1
9               Flat  2025-06-18  2025-06-30    12           NaN            9 
-------------------------------------------------------------------------------

Read more in the full documentation: russellsb.github.io/pytrendy/main

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

pytrendy-1.1.11.dev2.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

pytrendy-1.1.11.dev2-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file pytrendy-1.1.11.dev2.tar.gz.

File metadata

  • Download URL: pytrendy-1.1.11.dev2.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytrendy-1.1.11.dev2.tar.gz
Algorithm Hash digest
SHA256 b8eba8479a4bc023a4982853628048c62ffecbd52b2e74db00ea3bb17c10eb1f
MD5 ead0b45b26a88396aa492b51b9d14c58
BLAKE2b-256 344e7151237ac36dbcac2f347434ee49217c961b4b3ee2964e595b9dd45e7ac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytrendy-1.1.11.dev2.tar.gz:

Publisher: release.yaml on RussellSB/pytrendy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytrendy-1.1.11.dev2-py3-none-any.whl.

File metadata

  • Download URL: pytrendy-1.1.11.dev2-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytrendy-1.1.11.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ab5eb22871c62b2dc09083b37c5ad3e2967d248ac903045d55593af21bce49a
MD5 10950b76b0b54b1f0c4478f1ad8fc9ab
BLAKE2b-256 40c330f2d3047f543ed8f1845e191e94a3e85865bfcd00c4997bf30a227bbbf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytrendy-1.1.11.dev2-py3-none-any.whl:

Publisher: release.yaml on RussellSB/pytrendy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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