python-rle

Run-length encoding for data analysis in Python


License
MIT
Install
pip install python-rle==0.0.3

Documentation

pyrle (Work in Progress!)

Run-length encoding (wikipedia link) for data analysis in Python.

Usage

Motivation

Base R contains a simple rle function that "computes the lengths and values of runs of equal values in a vector", as described by its docstring. I found it useful for calculating streaks in collected data, and is especially wonderful for compiling and summarizing categorical data that describes status over time. I wasn't able to find an implementation of this in Python, other than the myriad of code examples that use run-length encoding to demonstrate data compression. Hence this little utility.