24 min

Popular Python Time Series Packages

Published on December 5, 2020

This note lists Python libraries relevant to time series prediction. They are ranked by monthly downloads in the last 30 days, which is no guarantee of quality. For some we've added a "hello world" example in timeseries-notebooks, to help you cut through the many different conventions. A growing number are exposed in a common functional signature explained in the timemachines  package. During testing those are assigned elo ratings based on performance out of sample on live data.  Although this can be a function of how they are used or misused, as much as it reflects quality of the package itself, a preponderance of evidence suggests that accuracy of time-series prediction could be improved if data scientists used the following selection method, rather than the echo-chamber:   

 

Online (Incremental) Filtering and Prediction

This category is a little hard to define, and it includes some state space and filtering packages where estimation might not be considerd incremental. 

  Downloads Hello Rated? Remarks
pykalman 81,857 notebook    
filterpy 25,004 notebook    no estimation
control 22,053      
pydlm 18,766 notebook elo  
microprediction 8,686      api univariate
simdkalman 8,173 notebook   vectorized
river 6,581 notebook   formerly "creme"
timemachines 3,605   creates Elos example Elo
timecast 399      
proust 341      
onelearn 330      
state-space 91     symbolic derivs
  The following are not packaged      
robust-kalman       github paper

Time Series Prediction

Prediction focussed packages only, and some yet to be moved to other categories. If you have a suggestion for these lists, please file an issue.

  Downloads Hello? Rated? Remarks, examples
fbprophet 769,124 notebook elo reviewed  discussion
pmdarima 300,638 notebook    
pygam 175,589      
hmmlearn 122,000      
autogluon 71,908      
stldecompose 65,607      
gluonts 23,459     paper paper
cronston 22,459      
forecast 22,207     broken
tbats 17,200      
timeseries 14,811      
pyflux 12,773 notebook    
ppscore 5,596      
pyculiar 5,031      
hcrystalball 4,500      
cesium 4,422      
neuralprophet 4,200 notebook   discussion
pytorch-forecasting 3,372 notebook   notebook almost done
seglearn 3,100      
auto_ts 2794 notebook    
autots 2,294      
tsai 2,635      
skits 2,630      
         
nitime 2,441      
time-series-predictor 2,021      
nbeats-keras 1,898     paper  post  c.f. nbeats-forecast, nbeats etc
pytorchts 1,759     paper
pydbm 1,700      
greykite 1,512     paper
da-dapper 1,501      
autotime 1,360      
orbit-ml 1,400     article docs Uber
u8darts 1,355     article
atspy 1,125      
tsmoothie 1,012      
causality 1,008     broken
autotsf 1,000      
flood-forecast 1,000     a.k.a. flow-forecast
anticipy 934      
arimafd 898      
pure-predict 801     lambda deploy
pyCWT 739      
pyinform 744      
gendis 692      
scikit-hts 644      M5 
cond-rnn 640      
scikit-hts 632     hierarchical
thyus-timeseries 557      
scifin 573      
openseries 538      
autoregressive 488      
va-timeseries 465      
pyaf 460      
theano-lstm 430      
esrnn 417     paper
firets 390      
darts 380      
time-series-generator 375     keras
proust 341     online
         
tods 323      
pysf 269      
timeseries_fastai 274      
giotto-time 266      
pyFTS 263      
pandas-timeseries 214      
pycatchmod 269      
timecopts 199      
phased_lstm_keras 177      
u8timeseries 155      
tendency-predict 150      
rnn 109      
tsf 103      
pytisean 98     wraps TISEAN
karas-on-lstm 90      
autoregression 80      
raptorarima 60      
pyda 59      
divinity 54 notebook    
  The following are not packaged on PyPI      
informer       AAAI '21 best paper
fforma       M5 discussion
dcrnn       github  paper
tensor-learning       github paper  multivariate, traffic
lstnet       github paper lstm traffic
dpsom       github paper clustering
dilate       github  paper
mtgnn       github paper graph NN
dsanet       github paper transformer
dts       github paper electricity
deepglow       github paper
dvmst-net       github paper
forecastnet       github paper
mlcnn-multivariate-time-series       github paper
mlip_m5       github paper
forgan       github paper
gru_ode_bayes       github paper sporadic
latent_ode       github paper irregular
processsequenceprediction       github paper
cycle_prediction       github doc arrival

If I have left something obvious out, please add it to the timeseries by popularity column.  Download statistics can be misleading, of course, and I think we all know the better metric is how well they perform in real-time on live data. Don't forget that many algorithms on the leaderboards have code badges allowing you to click through to the implementation. 

General purpose analytic libraries such as scipy and statsmodels are not included, though it goes without saying the time series capabilities are popular. You'd be crazy not to consider the big ones, though here the download statistics are even less relevant as time series is only a small part of their capability. Another good list is at paperswithcode

Time Series inside Larger Packages

  Monthly downloads Notes
tensorflow 4,586,049 hmm etc
sklearn 2,157,986 hmm -> hmmlearn, listed above
numpy 42,091,102  
scipy 14,107,552 scipy.stats etc
statsmodels 2,552,523 statsmodels.tsa
pandas 26,263,006  

Causality

Eye candy here generated with tigramite. Just out of scope is the Python Causality Handbook (github)

  Downloads Hello ? Remarks, examples  
causalnex 15,709   QuantumBlack  
syntheticcontrolmethods 2,757   explanation  
lingam 1,592   site paper  
tigramite 412 notebook gallery  paper   
misso 283      
nonlincausality 109    broken?  
pycute 88      
  Not on PyPI...      
rgcpd        
tcdf        
AmortizedCausalDiscovery     paper  
VLTimeSeriesCausality        
sru_for_cgi        
exact_linear_dependence        
         


Copulas

Eye candy here.

  Downloads Hello ? Discuss
copulas 184,467 gallery linkedin
copulabayesnet 553    
cvinemodel 371    
pycopula 296    
copulalib 272   broken?
copula 110    
copent 98    

If you have a suggestion for these lists, please file an issue.

Change-point Detection

 

  Downloads Hello? Remarks, examples Discuss
ruptures 559,553     paper
changefinder 15,899      
changepy 11,419      
bayesian-changepoint-detection 3,408      
changepoint_cython 475   from R changepoint  
bocd 138      
roufcp 138      
changepoint 109   paper  

 

Features, Outliers, Ensembles, Anomalies

If you have a suggestion for these lists, please file an issue.

  Downloads Hello ? Remarks, examples Discuss
tsfresh 168,000   features  
liminol 40,725   kernel  
traces 39,432   irregular  
stationarizer 647      
mvtsdata_toolkit 600   bitbucket  
luminaire 500      
magi 480   dask  
changepoint_cython 475   from R changepoint  
bocd 138   change point  
roufcp 138   change point  
changepoint 109   paper  
pytsmp 47      
  The following are not on PyPI      
anomalyMulti     blog  
db_oc_tsc      paper fe_ge_tsc (features)
         

Classification, Motifs, Neighbors, Wavelets, Transforms 

See also previous category and list of papers. If you have a suggestion for these lists, please file an issue.

  Downloads Hello ? Remarks, examples Discuss
pywavelets 2,219,206      
tslearn 50,000      
stumpy 21,000  notebook post  
signatory 9,952   paper  
pyEDM 9,328      
sktime 8,864   paper classification  
matrixprofile 5,839      
matrixprofile-ts 3,002      
pyts 2,584      
saxpy 1,479   paper  
mcfly 658      
kymatio 482   wavelets  
knn-lbenhanced 56   paper  
  The following are not on PyPI      
rocket     paper  
mkalgo   notebook   (fork)
os-cnn     paper  

Synthetic Time Series Generation

New category. Needs improvement. 

  Downloads Hello? Remarks, examples Discuss
deepecho 3,200 notebook new!  discussion
timesynth 166      
tsBNgen 98 notebook paper  
data-generation 76      
  The following are not released on PyPI      
tsgan     ML-AIM Lab  
synthetic-data-for-finance        
timegan     paper  
TimeSeries-GAN        
random-timeseries-generator        

If you have a suggestion for these lists, please file an issue.

What-if

New category

  Downloads Hello ? Remarks, examples
pycausalimpact 11,032    
causallib 1,689    

Distribution Fitting

See also scipy, statsmodels etc

  Downloads Notes
tdigest 432,000 Online. See blog article. 
iminuit 25,122 Robust likelihood distributions
fitter 9,806  
powerlaw 6,128  
reliability 5,906 Censored

There's a bit of a fine line between distribution fitting packages and optimization. 

Derivative Free Global Optimization

I've moved this table into HumpDay: A Package to Help You Choose a Python Global OptimizerAs you can read there, the following are current recommendations - probably better maintained on that page than here.  

Package Examples Form Guide
dlib dlib The algorithm find_min_global is fast, light and ingenious. It estimates the Lipschitz constant and constructs linear upper bounds, then samples the upper envelope function. If the degree to which your objective function varies across space isn't too great, and you are in dim<25, this is one way to get a free lunch. You will kick yourself for not inventing this. Strong contender! 
pySOT  dycors;  srbf  Implements Regis and Shoemaker's method using radial basis surrogates (paper), and stochastic radial basis function (paper). Compared to dlib, it is very heavy on computation, but if you are drilling holes in the ground that isn't going to be an issue. Definitely include in your trifectas.  
skopt default  skopt.gp_minimize. Like pySOT this uses surrogates and is good but by necessity, computationally heavy. A very popular library and underrepresented in the current Elo ratings somewhat due to the paucity of my wrapper. Expect good things. 
nevergrad ngpopt8 ; ngpopt4 A product of Facebook research, ngopt8 selects between optimizers, guided by benchmarking that is probably better than mine. See Algorithm 1 page 3 of the paperBlack Box Optimization Revisited by Meunier et al. I'm reliably informed that new meta-optimizers are on the way - yet the latest model is topping some of the leaderboards already. Don't lay.  
shgo nelder As discussed in Comparing Global Optimizers, SHGO is now one of the scipy global searches. It uses techniques from simplicial homology to avoid wasting samples, and seems to work very well in relatively low dimensional problems (say <=10) using either Nelder-Mead or Powell for local search. Each way chance. 
pymoo pattern Hooke and Jeeves pattern search (package notes, paper) from 1960 is still pretty good! Don't overlook. 
ax-platform default  Another effort at Facebook that is independent of nevergrad. The default global optimizer is part of a more extensive suite of tools and I'm reliably informed that some integration with nevergrad is likely (notwithstanding this issue)  Expect big things. 
optuna cmaes  I often see optuna compared to hyperopt, as if those were the only two packages in town. Well, if you must choose one of those two, make it Optuna. Flexible and well supported. A good bet in the right field. 

Some were compared in Comparing Python Global Optimizers previously. You can very marginally help this effort by yelling and screaming on Linked-in about it or joining discussions listed here, should you feel so inclined. Better yet, put a PR into HumpDay. There's also a library discussed here that you might want to try in conjunction with these. It modifies the objective function, so is uncoupled from the optimizer itself.  

Backtesting

Equities and crypto mostly 

  Downloads Notes  
backtrader 15,023 crypto  
prophet 10,872    
octobot 9,542    
jesse 5,012 crypto  
bt 4,563 fixed income  
vectorbt 4,192    
backtesting 4,182    
finlab-crypto 4,179    
zipline 4,178    
qtpylib 4,064    
rqalpha 2,260 chinese doc  
pyalgotrade 900    
zvt 900 chinese doc  
btrccts 880 crypto  
qstrader 426    
quant 280    
pinkfish 157    
quantdom 174    

If you have a suggestion for these lists, please file an issue.

Privacy Preservation for Time Series

New category

  The following are not deployed on PyPI  
pategan   paper

Notable But Not Exclusively for Time Series

Some potentially underestimated statistical libraries. 

  Downloads Remarks    
combo 86,774 emsembles    
suod 86,215 outliers    
pyod 85,000 outliers    
pycaret 53,000 time-series article    
hyppo 3,400 multivariate hypothesis    
baycomp 3,300 classification evaluation    
model_search   Feb 19, 2021    

 

To ensure articles like this are in your thread, or category updates here consider following microprediction on Linked-In. We're trying to make powerful bespoke AI free to the world, and you are welcome to contribute in large or small ways. If you have a suggestion for these lists, please file an issue.

 

 

 

 

 

Comments