Code Monkey home page Code Monkey logo

pytimetk's Introduction

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. 🐍

pytimetk's People

Contributors

mdancho84 avatar justinkurland avatar tackes avatar samuelmacedo83 avatar lucaso21 avatar gtimothee avatar iskode avatar

Stargazers

 avatar Gurumurthi V Ramanan avatar  avatar  avatar  avatar  avatar Fabio S. avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.