GithubHelp home page GithubHelp logo

monicwmm / sliding_window Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gravi80/sliding_window

0.0 0.0 0.0 50 KB

Python package to run sliding window on numpy array

Home Page: https://pypi.org/project/window-slider/

License: Apache License 2.0

Python 100.00%

sliding_window's Introduction

A python package to run sliding window with overlapping on numpy array

Status

Build Status PyPI last commit License FOSSA Status PyPI Package monthly downloads PyPI download week

Usage

$ pip install window-slider

$ python

from window_slider import Slider
import numpy
list = numpy.array([0, 1, 2, 3, 4, 5, 6, 7])
bucket_size = 3
overlap_count = 1
slider = Slider(bucket_size,overlap_count)
slider.fit(list)       
while True:
    window_data = slider.slide()
    # do your stuff
    print(window_data)
    if slider.reached_end_of_list(): break

numpy 2D array

from window_slider import Slider
import numpy
list = numpy.array([[0, 1, 2, 3],[0, 1, 2, 3]])
bucket_size = 3
overlap_count = 1
slider = Slider(bucket_size,overlap_count)
slider.fit(list)       
while True:
    window_data = slider.slide()
    # do your stuff
    print(window_data)
    if slider.reached_end_of_list(): break

wrap window data to custom class

class WindowData(object):
    def __init__(self, data):
        self._data = data
    
    def sum(self):
        return sum(self._data)
        

from window_slider import Slider
import numpy
list = numpy.array([0, 1, 2, 3, 4, 5, 6, 7])
bucket_size = 3
overlap_count = 1
slider = Slider(bucket_size,overlap_count,WindowData)
slider.fit(list)       
while True:
    window_data = slider.slide()
    # do your stuff
    print(window_data.sum())
    if slider.reached_end_of_list(): break

License

FOSSA Status

sliding_window's People

Contributors

gravi80 avatar fossabot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.