• Stars
    star
    673
  • Rank 67,060 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Time series easier, faster, more fun. Pytimetk.

pytimetk

Time series easier, faster, more fun. Pytimetk.

Please ⭐ us on GitHub (it takes 2-seconds and means a lot).

Introducing pytimetk: Simplifying Time Series Analysis for Everyone

Time series analysis is fundamental in many fields, from business forecasting to scientific research. While the Python ecosystem offers tools like pandas, they sometimes can be verbose and not optimized for all operations, especially for complex time-based aggregations and visualizations.

Enter pytimetk. Crafted with a blend of ease-of-use and computational efficiency, pytimetk significantly simplifies the process of time series manipulation and visualization. By leveraging the polars backend, you can experience speed improvements ranging from 3X to a whopping 3500X. Let's dive into a comparative analysis.

Features/Properties pytimetk pandas (+matplotlib)
Speed 🚀 3X to 3500X Faster 🐢 Standard
Code Simplicity 🎉 Concise, readable syntax 📜 Often verbose
plot_timeseries() 🎨 2 lines, no customization 🎨 16 lines, customization needed
summarize_by_time() 🕐 2 lines, 13.4X faster 🕐 6 lines, 2 for-loops
pad_by_time() ⛳ 2 lines, fills gaps in timeseries ❌ No equivalent
anomalize() 📈 2 lines, detects and corrects anomalies ❌ No equivalent
augment_timeseries_signature() 📅 1 line, all calendar features 🕐 29 lines of dt extractors
augment_rolling() 🏎️ 10X to 3500X faster 🐢 Slow Rolling Operations

As evident from the table, pytimetk is not just about speed; it also simplifies your codebase. For example, summarize_by_time(), converts a 6-line, double for-loop routine in pandas into a concise 2-line operation. And with the polars engine, get results 13.4X faster than pandas!

Similarly, plot_timeseries() dramatically streamlines the plotting process, encapsulating what would typically require 16 lines of matplotlib code into a mere 2-line command in pytimetk, without sacrificing customization or quality. And with plotly and plotnine engines, you can create interactive plots and beautiful static visualizations with just a few lines of code.

For calendar features, pytimetk offers augment_timeseries_signature() which cuts down on over 30 lines of pandas dt extractions. For rolling features, pytimetk offers augment_rolling(), which is 10X to 3500X faster than pandas. It also offers pad_by_time() to fill gaps in your time series data, and anomalize() to detect and correct anomalies in your time series data.

Join the revolution in time series analysis. Reduce your code complexity, increase your productivity, and harness the speed that pytimetk brings to your workflows.

Explore more at our pytimetk homepage.

Installation

Install the latest stable version of pytimetk using pip:

pip install pytimetk

Alternatively you can install the development version:

pip install git+https://github.com/business-science/pytimetk.git

Quickstart:

This is a simple code to test the function summarize_by_time:

import pytimetk as tk
import pandas as pd

df = tk.datasets.load_dataset('bike_sales_sample')
df['order_date'] = pd.to_datetime(df['order_date'])

df \
    .groupby("category_2") \
    .summarize_by_time(
        date_column='order_date', 
        value_column= 'total_price',
        freq = "MS",
        agg_func = ['mean', 'sum']
    )

Documentation

Get started with the pytimetk documentation

Developers (Contributors): Installation

To install pytimetk using Poetry, follow these steps:

1. Prerequisites

Make sure you have Python 3.9 or later installed on your system.

2. Install Poetry

To install Poetry, you can use the official installer provided by Poetry. Do not use pip.

3. Clone the Repository

Clone the pytimetk repository from GitHub:

git clone https://github.com/business-science/pytimetk

4. Install Dependencies

Use Poetry to install the package and its dependencies:

poetry install

or you can create a virtualenv with poetry and install the dependencies

poetry shell
poetry install

🏆 More Coming Soon...

We are in the early stages of development. But it's obvious the potential for pytimetk now in Python. 🐍

More Repositories

1

free_r_tips

Free R-Tips is a FREE Newsletter provided by Business Science. It comes with bite-sized code tutorials every week.
HTML
1,267
star
2

tidyquant

Bringing financial analysis to the tidyverse
R
850
star
3

timetk

Time series analysis in the `tidyverse`
R
608
star
4

modeltime

Modeltime unlocks time series forecast models and machine learning in one framework
R
515
star
5

anomalize

Tidy anomaly detection
R
337
star
6

tibbletime

Time-aware tibbles
R
179
star
7

presentations

A central repository of Business Science presentations
HTML
165
star
8

sweep

Extending broom for time series forecasting
R
155
star
9

correlationfunnel

Speed Up Exploratory Data Analysis (EDA)
R
132
star
10

cheatsheets

101
star
11

free_python_tips

HTML
79
star
12

modeltime.ensemble

Time Series Ensemble Forecasting
R
73
star
13

alphavantager

A lightweight R interface to the Alpha Vantage API
R
69
star
14

riingo

An R interface to the Tiingo stock price API
R
51
star
15

10_python_r_business_problems

Python
48
star
16

modeltime.h2o

Forecasting with H2O AutoML. Use the H2O Automatic Machine Learning algorithm as a backend for Modeltime Time Series Forecasting.
R
40
star
17

modeltime.gluonts

GluonTS Deep Learning with Modeltime
R
39
star
18

portfoliodown

An R package for creating professional data science portfolios
CSS
37
star
19

gpu_accelerated_forecasting_modeltime_gluonts

GPU-Accelerated Deep Learning for Time Series using Modeltime GluonTS (Learning Lab 53). Event sponsors: Saturn Cloud, NVIDIA, & Business Science.
HTML
22
star
20

modeltime.resample

Resampling Tools for Time Series Forecasting with Modeltime
R
19
star
21

reports

A central repository of Business Science technical reports
17
star
22

workshop_2018_dsgo

DataScienceGO 2018 - Machine Learning Workshop
R
13
star
23

lab_59_cust_lifetime_py

Learning Lab 59: Customer Lifetime Value Python
Python
12
star
24

pymodeltime

Pymodeltime offers a unified framework tailored to address a broad spectrum of requirements, including time series forecasting and various machine learning models.
Python
12
star
25

awesome-generative-ai

A curated list of resources for building and deploying generative AI specifically focusing on helping you become a GenAI developer with LLMs
12
star
26

shinyauth

Dockerfile
Dockerfile
10
star
27

gammodels

The parsnip backend for GAM Models.
R
7
star
28

modeltime_h2o_workshop

R
6
star
29

webinar_introducing_pytimetk

Jupyter Notebook
5
star
30

lab_50_lightgbm

Learning Lab 50: Hierarchical Forecasting
R
5
star
31

free_ai_training

Free training to get you started learning AI for data science today!
Jupyter Notebook
5
star
32

workshop_timetk_data_viz

R
3
star
33

bsu-dev

Code for development of Business Science University courses.
3
star
34

lab_63_nested_modeltime

R
1
star
35

courseinfo

Course information, curriculum, and brochures
1
star