Skip to content
A Python port of Twitter's AnomalyDetection R Package
Branch: master
Clone or download

Latest commit

Nicolas Steven Miller
Nicolas Steven Miller Merge pull request #26 from ericist/division
changed float to int division
Latest commit a06f597 Aug 29, 2018


Type Name Latest commit message Commit time
Failed to load latest commit information.
pyculiarity changed float to int division Aug 28, 2018
tests near py3 compatibility Jan 13, 2018
.gitignore update readme and gitignore Jul 10, 2015
LICENSE initial Jul 10, 2015 initial Jul 10, 2015
README update readme Jul 10, 2015 add markdown readme Jul 10, 2015
setup.cfg initial Jul 10, 2015 update version Aug 28, 2018


A Python port of Twitter's AnomalyDetection R Package. The original source and examples are available here:


The package currently requires rpy2 in order to use R's stl function. A working R installation must be available. In the future, we'll move to an stl implementation that doesn't require R. One candidate for this is

As in Twitter's package, there are two top level functions, one for timeseries data and one for simple vector processing, detect_ts and detect_vec respectively. The first one expects a two-column Pandas DataFrame consisting of timestamps and values. The second expects either a single-column DataFrame or a Series.

Here's an example of loading Twitter's example data (included in the tests directory) with Pandas and passing it to Pyculiarity for processing.

from pyculiarity import detect_ts
import pandas as pd
twitter_example_data = pd.read_csv('raw_data.csv',
                                    usecols=['timestamp', 'count'])
results = detect_ts(twitter_example_data,
                    direction='both', only_last='day')

Run the tests

The tests are run with nose as follows:

nosetests .

Copyright and License

Python port Copyright 2015 Nicolas Steven Miller Original R source Copyright 2015 Twitter, Inc and other contributors

Licensed under the GPLv3

You can’t perform that action at this time.