Function reference
π Data Visualization
Visualize time series data with one line of code.
| plot_timeseries | Creates time series plots using different plotting engines such as Plotnine, |
π₯ Wrangling Pandas Time Series DataFrames
Bend time series data to your will.
| summarize_by_time | Summarize a DataFrame or GroupBy object by time. |
| apply_by_time | Apply for time series. |
| pad_by_time | Make irregular time series regular by padding with missing dates. |
| filter_by_time | Filters a DataFrame or GroupBy object based on a specified date range. |
| future_frame | Extend a DataFrame or GroupBy object with future dates. |
π Anomaly Detection
Detect anomalies in time series data.
| anomalize | Detects anomalies in time series data, either for a single time |
| plot_anomalies | Creates plot of anomalies in time series data using Plotly, Matplotlib, |
| plot_anomalies_decomp | The plot_anomalies_decomp function takes in data from the anomalize() |
| plot_anomalies_cleaned | The plot_anomalies_cleaned function takes in data from the anomalize() |
πͺοΈ Correlation Funnel
Visualize correlation on any tabular dataset (not just for Time Series).
| binarize | The binarize function prepares data for correlate, which is used for analyzing correlationfunnel plots. |
| correlate | The correlate function calculates the correlation between a target variable and all other |
| plot_correlation_funnel | The plot_correlation_funnel function generates a correlation funnel plot using either Plotly or |
ποΈ Feature Engineereing
Adding Features to Time Series DataFrames (Augmenting)
| augment_timeseries_signature | The function augment_timeseries_signature takes a DataFrame and a date |
| augment_holiday_signature | Engineers 4 different holiday features from a single datetime for 137 countries |
| augment_lags | Adds lags to a Pandas DataFrame or DataFrameGroupBy object. |
| augment_leads | Adds lead columns to a pandas or polars DataFrame (or grouped DataFrame). |
| augment_diffs | Adds differences and percentage difference (percentage change) to a Pandas DataFrame or DataFrameGroupBy object. |
| augment_pct_change | Adds percentage difference (percentage change) columns to pandas or polars data. |
| augment_rolling | Apply one or more Series-based rolling functions and window sizes to one or more columns of a DataFrame. |
| augment_rolling_apply | Apply one or more DataFrame-based rolling functions and window sizes to one |
| augment_expanding | Apply one or more Series-based expanding functions to one or more columns of a DataFrame. |
| augment_expanding_apply | Apply one or more DataFrame-based expanding functions to one or more columns of a DataFrame. |
| augment_ewm | Add Exponential Weighted Moving (EWM) window functions to a DataFrame or |
| augment_fourier | Adds Fourier transforms to a Pandas DataFrame or DataFrameGroupBy object. |
| augment_hilbert | Apply the Hilbert transform to specified columns of a DataFrame or |
| augment_wavelet | Apply the Wavely transform to specified columns of a DataFrame or |
| augment_spline | Add spline basis expansions for a numeric column. |
ποΈ Feature Store & Caching (Beta)
Beta: persist and reuse feature engineering artifacts with caching and metadata.
| feature_store | Feature store and caching helpers for pytimetk. |
| FeatureStore | Lightweight on-disk feature store with metadata cataloguing. |
| FeatureStoreAccessor | Polars .tk accessor helper that operates against a feature store instance. |
| FeatureSetMetadata | Immutable metadata describing a single materialised feature set. |
| FeatureSetResult | Wrapper returned by the feature store for build/load operations. |
π TS Features
Python implementation of the R package tsfeatures.
| ts_features | Extracts aggregated time series features from a DataFrame or DataFrameGroupBy object using the tsfeatures package. |
| ts_summary | Computes summary statistics for a time series data, either for the entire |
π Time Series Cross Validation (TSCV)
Time series cross validation.
| TimeSeriesCV | TimeSeriesCV is a subclass of TimeBasedSplit with default mode set to βbackwardβ |
| TimeSeriesCVSplitter | The TimeSeriesCVSplitter is a scikit-learn compatible cross-validator using TimeSeriesCV. |
πΉ Finance Module (Momentum Indicators)
Momentum indicators for financial time series data.
| augment_macd | Calculate MACD for a given financial instrument using either pandas or polars engine. |
| augment_ppo | Calculate the Percentage Price Oscillator (PPO) for pandas or polars data. |
| augment_rsi | Calculate the Relative Strength Index (RSI) for pandas or polars data. |
| augment_cmo | Calculate the Chande Momentum Oscillator (CMO) using pandas or polars backends. |
| augment_roc | Add rate-of-change (ROC) columns to a pandas or polars DataFrame. |
| augment_adx | Calculate Average Directional Index (ADX), +DI, and -DI using pandas or polars backends. |
| augment_stochastic_oscillator | Calculate Stochastic Oscillator (%K and %D) using pandas or polars backends. |
| augment_hurst_exponent | Calculate the Hurst Exponent on a rolling window for a financial time series. Used for detecting trends and mean-reversion. |
| augment_qsmomentum | Calculate Quant Science Momentum (QSM) for pandas or polars inputs. |
| augment_fip_momentum | Calculate the βFrog In The Panβ (FIP) momentum metric over one or more rolling windows |
πΉ Finance Module (Volatility, Risk/Reward and Regime Indicators)
Volatility, Risk-Reward, and Regime indicators for financial time series data.
| augment_bbands | Calculate Bollinger Bands for pandas or polars data. |
| augment_atr | Calculate Average True Range (ATR) or Normalised ATR for pandas or polars data. |
| augment_drawdown | Calculate running drawdown statistics for pandas or polars data. |
| augment_rolling_risk_metrics | The augment_rolling_risk_metrics function calculates rolling risk-adjusted performance |
| augment_ewma_volatility | Calculate Exponentially Weighted Moving Average (EWMA) volatility for a financial time series. |
| augment_regime_detection | Detect regimes in a financial time series using a specified method (e.g., HMM). |
πΌ Time Series for Pandas Series
Time series functions that generate / manipulate Pandas Series.
| make_future_timeseries | Make future dates for a time series. |
| make_weekday_sequence | Generate a sequence of weekday dates within a specified date range, |
| make_weekend_sequence | Generate a sequence of weekend dates within a specified date range, |
| get_date_summary | Returns a summary of the date-related information, including the number of |
| get_frequency_summary | More robust version of pandas inferred frequency. |
| get_diff_summary | Calculates summary statistics of the time differences between consecutive values in a datetime index. |
| get_frequency | Get the frequency of a pandas Series or DatetimeIndex. |
| get_seasonal_frequency | The get_seasonal_frequency function returns the seasonal period of a given |
| get_trend_frequency | The get_trend_frequency function returns the trend period of a given time |
| get_timeseries_signature | Convert a timestamp to a set of 29 time series features. |
| get_holiday_signature | Engineers 4 different holiday features from a single datetime for 137 countries |
π οΈ Date Utilities
Helper functions to make your life easier.
| floor_date | Robust date flooring. |
| ceil_date | Robust date ceiling. |
| is_holiday | Check if a given list of dates are holidays for a specified country. |
| week_of_month | The βweek_of_monthβ function calculates the week number of a given date |
| timeseries_unit_frequency_table | The function timeseries_unit_frequency_table returns a pandas DataFrame |
| time_scale_template | The function time_scale_template returns a table with time scale |
π οΈ Visualization Utilities
Helper functions to make your life easier.
| theme_timetk | Returns a plotnine theme with timetk styles applied, allowing for |
| palette_timetk | The function palette_timetk returns a dictionary of color codes for |
Extra Pandas Helpers (That Help Beyond Just Time Series)
| glimpse | Takes a pandas DataFrame and prints a summary of its dimensions, column |
| parallel_apply | The parallel_apply function parallelizes the application of a function on |
| progress_apply | Adds a progress bar to pandas apply(). |
| drop_zero_variance | The function drop_zero_variance takes a pandas DataFrame as input and returns a new DataFrame with |
| transform_columns | The function transform_columns applies a user-provided function to specified columns in a pandas DataFrame. |
| flatten_multiindex_column_names | Takes a DataFrame as input and flattens the column |
πΎ 13 Datasets
Practice pytimetk with 13 complementary time series datasets.
| get_available_datasets | Get a list of 12 datasets that can be loaded with pytimetk.load_dataset. |
| load_dataset | Load one of 12 Time Series Datasets. |