unit8co/darts: one Python API for forecasting and anomaly detection
A python library for user-friendly forecasting and anomaly detection on time series.
At a glance
- What is it?
- Darts wraps statistical models, neural forecasters and anomaly scorers behind scikit-learn style fit and predict calls. It suits engineers who want to compare many models on the same TimeSeries object, and it costs a large dependency tree to get there.
- Who is it for?
- Adopt darts when you need to compare several model families on one series representation, or when you want forecasting and anomaly detection in the same codebase. Skip it if a single classical model or a minimal dependency set is enough, since pip install darts pulls in torch, pyod, shap, statsmodels and more.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 13 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 17, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The problem darts solves: one API across model families
Forecasting code usually fragments fast. An ARIMA model lives in statsmodels, a gradient boosted forecaster lives in scikit-learn, a neural forecaster lives in its own repository with its own training loop, and each expects a differently shaped input. Comparing them means writing glue for every pair. Darts targets that fragmentation: the README states that its forecasting models "can all be used in the same way, using fit() and predict() functions, similar to scikit-learn." The audience is applied engineers and data scientists who have a pandas DataFrame of timestamped values and want to try several approaches without rewriting the data plumbing each time. The library covers univariate and multivariate series, and the README notes that ML-based models can be trained on datasets containing multiple time series. Anomaly detection is a second audience: the README describes applying PyOD models to time series for anomaly scores, or wrapping any forecasting or filtering model into an anomaly detector.
TimeSeries objects, covariates and the fit/predict contract
The central abstraction is the TimeSeries class. The README example reads a CSV into a pandas DataFrame and constructs a series with TimeSeries.from_dataframe(df, "Month", "#Passengers"), naming the time column and the value column explicitly. Slicing behaves like Python sequences: series[:-36] and series[-36:] produce the train and validation splits, so a holdout is one line rather than a resample-and-join dance. Models then follow a two-call contract. model.fit(train) trains, and model.predict(len(val), num_samples=1000) returns a forecast whose horizon is set by the length of the validation series. Passing num_samples gives a probabilistic forecast, and the README plots it with prediction.plot(label="forecast", low_quantile=0.05, high_quantile=0.95), which draws the median plus the 5th and 95th percentiles. External information enters as covariates; the repository ships examples/01-multi-time-series-and-covariates.ipynb and examples/15-static-covariates.ipynb, and the README links an article on using past and future covariates. Anomaly detection reuses the same shape. A KMeansScorer is fit on the training series and scores the validation series; a QuantileDetector is then fit on the training scores and produces a binary classification on the validation scores. Two stages, both with fit, and the threshold lives in the detector rather than in the scorer.
Installing darts and running a first forecast
The README recommends a clean environment on Python 3.10 or newer before installing. The pyproject.toml sets requires-python to ">=3.10" and lists the runtime dependencies, which include pandas, numpy, scikit-learn, statsmodels, pyod, shap, matplotlib and numba. That is a heavy install, and the numba and llvmlite entries carry platform markers for macOS on x86_64, where newer wheels were dropped. The plain install is one command:
pip install dartsFor anything beyond the default set, the README points to INSTALL.md in the repository rather than documenting the optional extras inline. Once installed, the quickstart flow builds a series from a DataFrame, holds out the last 36 points, and fits exponential smoothing:
import pandas as pd
from darts import TimeSeries
from darts.models import ExponentialSmoothing
df = pd.read_csv("AirPassengers.csv", delimiter=",")
series = TimeSeries.from_dataframe(df, "Month", "#Passengers")
train, val = series[:-36], series[-36:]
model = ExponentialSmoothing()
model.fit(train)
prediction = model.predict(len(val), num_samples=1000)After this runs, prediction holds a probabilistic forecast of length len(val). Plotting it with prediction.plot(label="forecast", low_quantile=0.05, high_quantile=0.95) shows the median band against the actual validation values. If you would rather not manage the environment yourself, the repository includes a Dockerfile based on python:3.12-slim that installs uv and runs uv sync --group dev-all, with build and run instructions in its comments.
Where darts gets in the way
The dependency list is the first constraint. A project that only needs ARIMA has to accept pandas, scikit-learn, statsmodels, pyod, shap, matplotlib, numba and their transitive dependencies, plus whatever the neural models require, because the README does not present a core-only installation path. The Dockerfile comment is explicit that --no-dev would install only core dependencies, but that the image instead uses --group dev-all for the full environment, which tells you the maintainers expect the full stack in that context. A second limit is horizon semantics. predict takes the number of steps, and the README example derives it from len(val), so recursive multi-step forecasting is the default shape; nothing in the README describes a direct multi-horizon mode. Third, the anomaly detection API is two-stage by design. You must choose a scorer, fit it, then choose a detector and fit it on the scorer's training output. If your anomaly definition is a simple threshold on a raw metric, this is more machinery than the problem needs. Finally, the README does not document rollback or downgrade procedures for the library itself, so version pinning is on you.
darts compared with statsmodels and Prophet
Statsmodels is the closest classical alternative and it is already a darts dependency. The difference is scope and interface. Statsmodels exposes each model with its own parameterization and result object; you build an ARIMA with an order tuple, get back a results object, and call forecast or get_forecast with different argument conventions per model. Darts puts a single fit and predict pair in front of ARIMA, exponential smoothing, filtering models such as the Kalman and Gaussian process filters shown in examples/10 and examples/11, and neural models including N-BEATS, TCN, Transformer, TFT and TiDE, each with a notebook in examples/. Statsmodels does not ship neural forecasters, and it has no anomaly detection layer comparable to the scorer and detector pair. Prophet takes the opposite trade: one model with a specific additive structure, a dataframe with ds and y columns, and very little model choice. If your series has a strong seasonal pattern and you want one defensible model with minimal code, Prophet is narrower and easier to reason about. Darts is the better fit when the model itself is the variable you are trying to settle, and you want the data handling to stay constant while you change it.
Licence, maintenance and upgrade cost
Darts is released under Apache-2.0, declared both in the repository LICENSE file and in pyproject.toml as license = "Apache-2.0". That permits commercial use and modification with the usual notice and attribution conditions; it is a permissive licence, not a copyleft one, but the terms still apply to redistribution, so read the LICENSE text rather than assuming. On maintenance, the last push to master was on 2026-09-07 and the most recent release is 0.47.0 from 2026-09-04, with 0.46.0 and 0.46.1 in July 2026. The repository is not archived. Releases are versioned as minor and patch, and the CHANGELOG.md at the repository root is where breaking changes would be recorded. The upgrade cost is dominated by the dependency graph rather than the darts API: a minor bump can move scikit-learn, pandas, numpy or numba constraints, and the platform markers around numba and llvmlite mean a macOS x86_64 environment can pin you to older versions of both. Pin darts and its numerical dependencies together, and read CHANGELOG.md before moving a production environment.
Editorial conclusion
Adopt darts when you need to compare several model families on one series representation, or when you want forecasting and anomaly detection in the same codebase. Skip it if a single classical model or a minimal dependency set is enough, since pip install darts pulls in torch, pyod, shap, statsmodels and more. Before committing, check the INSTALL.md instructions for the optional dependencies your chosen models need, and confirm that the model you intend to use appears in examples/ with a runnable notebook.
Frequently asked questions
How do you install darts?
The README recommends setting up a clean Python environment on Python 3.10 or newer, then running pip install darts. For optional dependencies beyond the default set, it points to INSTALL.md in the repository.
How do you use darts for forecasting?
Build a TimeSeries with TimeSeries.from_dataframe, split it into train and validation slices, then call model.fit(train) and model.predict(len(val)). The README's example uses ExponentialSmoothing with num_samples=1000 to get a probabilistic forecast.
Does darts require a specific Python version?
Yes. The pyproject.toml sets requires-python to ">=3.10", and the README's install section says to set up an environment with Python 3.10+.
Can darts do anomaly detection as well as forecasting?
The README documents an anomaly detection path separate from forecasting: a scorer such as KMeansScorer is fit on the training series and scores the validation series, then a detector such as QuantileDetector is fit on the training scores and produces a binary classification.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/unit8co-darts)