Python implementation of a sliding window.
Project description
Time Series
A simple python implementation of a sliding window.
Installation
pip install time-series
Examples
import timeseries
# max 10 data points
fixed_window = timeseries.Fixed(10)
# removes added data points after 10 seconds
timer_window = timeseries.Timer(10)
# deletes data points after 10 iterations
for i in range(100):
current_window = fixed_window.slide(i)
# deletes data points after 10 seconds have elapsed.
for i in range(100):
current_window = timer_window.slide(i)
# prints 89...99
for i in fixed_window:
print(i)
# will most likely print 0...99
for i in timer_window:
print(i)
if fixed_window.is_full:
print("fixed window is full")
# shrinks the number of elements to 2 (threadsafe)
fixed_window.maxsize = 2
# print current number of items
print(timer_window.size, len(timer_window))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
time-series-0.2.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for time_series-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6872eb94d9ef80b5c7ed3c5d38511dec3f1fec6b2c6b8c587c475d8cf7b397b8 |
|
MD5 | 198d1dd90d6932a2e4a6645d708a1d1e |
|
BLAKE2b-256 | 8216a6f73386a6d44149d3b71de2d4da6525b7df70b2a795b2a63ad778914592 |