• Stars
    star
    577
  • Rank 74,505 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created about 3 years ago
  • Updated about 2 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,167
star
2

tidyquant

Bringing financial analysis to the tidyverse
R
828
star
3

timetk

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

modeltime

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

anomalize

Tidy anomaly detection
R
335
star
6

tibbletime

Time-aware tibbles
R
179
star
7

presentations

A central repository of Business Science presentations
HTML
164
star
8

sweep

Extending broom for time series forecasting
R
154
star
9

correlationfunnel

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

cheatsheets

92
star
11

free_python_tips

HTML
79
star
12

modeltime.ensemble

Time Series Ensemble Forecasting
R
71
star
13

alphavantager

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

riingo

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

modeltime.h2o

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

modeltime.gluonts

GluonTS Deep Learning with Modeltime
R
37
star
17

portfoliodown

An R package for creating professional data science portfolios
CSS
36
star
18

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
19

reports

A central repository of Business Science technical reports
17
star
20

modeltime.resample

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

workshop_2018_dsgo

DataScienceGO 2018 - Machine Learning Workshop
R
13
star
22

shinyauth

Dockerfile
Dockerfile
10
star
23

pymodeltime

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

gammodels

The parsnip backend for GAM Models.
R
7
star
25

modeltime_h2o_workshop

R
5
star
26

webinar_introducing_pytimetk

Jupyter Notebook
5
star
27

10_python_r_business_problems

Python
5
star
28

bsu-dev

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

workshop_timetk_data_viz

R
3
star
30

lab_63_nested_modeltime

R
1
star
31

courseinfo

Course information, curriculum, and brochures
1
star