<commit_before>lttb.py |pypi|
==============

Numpy implementation of Steinarsson’s *Largest-Triangle-Three-Buckets*
algorithm for downsampling time series–like data

Based on the original JavaScript code:

https://github.com/sveinn-steinarsson/flot-downsample

and:

<NAME>. 2013.  *Downsampling Time Series for Visual
Representation.* MSc thesis. University of Iceland.

A test data set is provided in ``tests/timeseries.csv``.
It was downloaded from http://flot.base.is/ and converted from JSON to CSV.


Usage
-----

.. code:: python

   import numpy as np
   import lttb
   data = np.array([range(100), np.random.random(100)]).T
   small_data = lttb.downsample(data, n_out=20)
   assert small_data.shape == (20, 2)

For example, here is the data set provided in ``tests`` downsampled to 100
points:

.. image:: http://github.com/javiljoen/lttb.py/raw/master/tests/timeseries.png


Installation
------------

To install the ``lttb`` package into your (virtual) environment::

   pip install lttb
<commit_msg>Fix image link in readme<commit_after>lttb.py |pypi|
==============

Numpy implementation of Steinarsson’s *Largest-Triangle-Three-Buckets*
algorithm for downsampling time series–like data

Based on the original JavaScript code:

https://github.com/sveinn-steinarsson/flot-downsample

and:

<NAME>. 2013.  *Downsampling Time Series for Visual
Representation.* MSc thesis. University of Iceland.

A test data set is provided in ``tests/timeseries.csv``.
It was downloaded from http://flot.base.is/ and converted from JSON to CSV.


Usage
-----

.. code:: python

   import numpy as np
   import lttb
   data = np.array([range(100), np.random.random(100)]).T
   small_data = lttb.downsample(data, n_out=20)
   assert small_data.shape == (20, 2)

For example, here is the data set provided in ``tests`` downsampled to 100
points:

.. image:: https://github.com/javiljoen/lttb.py/raw/master/tests/timeseries.png


Installation
------------

To install the ``lttb`` package into your (virtual) environment::

   pip install lttb

{'fraction_non_alphanumeric': 0.13457760314341846, 'fraction_numerical': 0.01768172888015717, 'mean_word_length': 3.8615751789976134, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4345238', 'n_tokens_mistral': 700, 'n_tokens_neox': 645, 'n_words': 206}