Python implementation of a sliding window.
Project description
Time Series
A simple python implementation of a sliding window.
Installation
pip install timeseries
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.1.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for time_series-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 221238a1cfcb736295529c2f4619b72130b42d7d936d723de165541bd246b9cb |
|
MD5 | d9002712a8a4993be0fe31139de33f1e |
|
BLAKE2b-256 | 8034333d1d717c0008cfdc0c23d5adca8014e2456a5637c3fc08833b6958d0e5 |