unit8co /darts

A python library for user-friendly forecasting and anomaly detection on time series.

★ 9,589⑂ 1,095👁 62⑃ 1,487● 1,884▤ 66
PythonApache-2.0Created 2018-09-13unit8co.github.io/darts/
下载:Darts patch 0.48.1Darts-0.48.1 ↓0.48.12026-10-16
+0
日增长
9,589
stars
1,095
forks
62
watchers
1,487
prs
1,884
issues
66
releases

README

Time Series Made Easy in Python

!darts

---


!Supported versions

!GitHub Release Date
!GitHub Workflow Status



 

Darts is a Python library for user-friendly forecasting and anomaly detection
on time series. It contains a variety of models, from classics such as ARIMA to
deep neural networks. The forecasting models can all be used in the same way,
using fit() and predict() functions, similar to scikit-learn.
The library also makes it easy to backtest models,
combine the predictions of several models, and take external data into account.
Darts supports both univariate and multivariate time series and models.
The ML-based models can be trained on potentially large datasets containing multiple time
series, and some of the models offer a rich support for probabilistic forecasting.

Darts also offers extensive anomaly detection capabilities.
For instance, it is trivial to apply PyOD models on time series to obtain anomaly scores,
or to wrap any of Darts forecasting or filtering models to obtain fully
fledged anomaly detection models.


 Documentation
 Quickstart
 User Guide
 API Reference
 Examples

 High Level Introductions
 Introductory Blog Post
 Introduction video (25 minutes)

 Articles on Selected Topics
 Training Models on Multiple Time Series
 Using Past and Future Covariates
 Temporal Convolutional Networks and Forecasting
 Probabilistic Forecasting
 Transfer Learning for Time Series Forecasting
 Hierarchical Forecast Reconciliation

 Quick Install

We recommend to first setup a clean Python environment for your project with Python 3.11+ using your favorite tool
(conda,
venv, virtualenv with
or without virtualenvwrapper).

Once your environment is set up you can install darts using pip:

    pip install darts

For more details you can refer to our
installation instructions.

 Example Usage

 Forecasting

Create a TimeSeries object from a Pandas DataFrame, and split it in train/validation series:

python
import pandas as pd
from darts import TimeSeries

 Read a pandas DataFrame
df = pd.read_csv("AirPassengers.csv", delimiter=",")

 Create a TimeSeries, specifying the time and value columns
series = TimeSeries.from_dataframe(df, "Month", "Passengers")

 Set aside the last 36 months as a validation series
train, val = series[:-36], series[-36:]


Fit an exponential smoothing model, and make a (probabilistic) prediction over the validation series' duration:

python
from darts.models import ExponentialSmoothing

model = ExponentialSmoothing()
model.fit(train)
prediction = model.predict(len(val), num_samples=1000)


Plot the median, 5th and 95th percentiles:

python
import matplotlib.pyplot as plt

series.plot()
prediction.plot(label="forecast", low_quantile=0.05, high_quantile=0.95)
plt.legend()






 Anomaly Detection

Load a multivariate series, trim it, keep 2 components, split train and validation sets:

python
from darts.datasets import ETTh2Dataset

series = ETTh2Dataset().load()[:10000][["MUFL", "LULL"]]
train, val = series.split_befo

Top issues

Latest release

Darts patch 0.48.1 0.48.1 2026-10-16
We are pleased to announce the release of a new Darts version.

You can find a list with all changes in the release notes.

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON