Skip to main content

No project description provided

Project description

cougar

A python C-extension for rolling window aggregations. Try to support more methods than bottleneck and run faster than pandas. Currently this is only a weekend project, feel free to contribute.

Installation

pip install cougar

Usage

>>> import numpy as np
>>> import cougar as cg


>>> arr = np.random.randn(8)
>>> arr
array([-2.31572505, -1.78462521,  0.17355123,  0.77365821,  0.81431295,
        1.56188616,  0.74933881,  0.06184727])
>>> cg.rolling_mean(arr, 3)
array([        nan,         nan, -1.30893301, -0.27913859,  0.58717413,
        1.04995244,  1.04184597,  0.79102408])
>>> cg.rolling_rank(arr, 5, min_count=1)
array([ 0. ,  1. ,  1. ,  1. ,  1. ,  1. , -0.5, -1. ])

Supported Methods

Method Time Complexity
sum $O(1)$
mean $O(1)$
std $O(1)$
var $O(1)$
skew $O(1)$
kurt $O(1)$
min $O(1)$
max $O(1)$
argmin $O(1)$
argmax $O(1)$
median $O(\log n)$
rank $O(\log n)$
quantile $O(\log n)$

Benchmark

python benchmark.py
            Cougar vs. Bottleneck             
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Method       ┃ Cougar       ┃ Bottleneck   ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ sum          │ 2.99         │ 1.00         │
│ mean         │ 3.08         │ 1.00         │
│ std          │ 2.10         │ 1.00         │
│ var          │ 2.15         │ 1.00         │
│ max          │ 2.84         │ 1.00         │
│ min          │ 1.23         │ 1.00         │
│ argmax       │ 1.40         │ 1.00         │
│ argmin       │ 1.16         │ 1.00         │
│ median       │ 1.33         │ 1.00         │
│ rank         │ 1.00         │ 15.02        │
└──────────────┴──────────────┴──────────────┘

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cougar-0.5.13.tar.gz (8.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cougar-0.5.13-cp311-cp311-win_amd64.whl (49.5 kB view details)

Uploaded CPython 3.11Windows x86-64

cougar-0.5.13-cp311-cp311-manylinux1_x86_64.whl (269.2 kB view details)

Uploaded CPython 3.11

cougar-0.5.13-cp311-cp311-macosx_10_9_universal2.whl (82.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

cougar-0.5.13-cp310-cp310-win_amd64.whl (49.5 kB view details)

Uploaded CPython 3.10Windows x86-64

cougar-0.5.13-cp310-cp310-manylinux1_x86_64.whl (268.4 kB view details)

Uploaded CPython 3.10

cougar-0.5.13-cp310-cp310-macosx_11_0_x86_64.whl (53.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

cougar-0.5.13-cp39-cp39-win_amd64.whl (49.6 kB view details)

Uploaded CPython 3.9Windows x86-64

cougar-0.5.13-cp39-cp39-manylinux1_x86_64.whl (268.0 kB view details)

Uploaded CPython 3.9

cougar-0.5.13-cp39-cp39-macosx_11_0_x86_64.whl (53.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

cougar-0.5.13-cp38-cp38-win_amd64.whl (49.5 kB view details)

Uploaded CPython 3.8Windows x86-64

cougar-0.5.13-cp38-cp38-manylinux1_x86_64.whl (269.5 kB view details)

Uploaded CPython 3.8

cougar-0.5.13-cp38-cp38-macosx_11_0_x86_64.whl (53.5 kB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

File details

Details for the file cougar-0.5.13.tar.gz.

File metadata

  • Download URL: cougar-0.5.13.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cougar-0.5.13.tar.gz
Algorithm Hash digest
SHA256 faeeb8341221077d57ba5ae7f32b2d49f3ddaff2157c9e2a348f937e2d6a9834
MD5 05a0bb5f7caefb1141a886c54c5bf7e4
BLAKE2b-256 b24ce94c98bfa332cdca9015f3cb2477861049a217c8230315f24d36815d0fcf

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cougar-0.5.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cougar-0.5.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e45c2e6025316397cab8feabb5f6203516f082f1421ac0a233bc03e9b092f9b3
MD5 343275eabacd8e340bef81539955f815
BLAKE2b-256 92e3b0015a89a01b4ad643f0f54338c81cfa827f34cb59f5ead0382c5db15167

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 24b173f4fa424a618fde8092fa6715b909031fb40d6c4e34ba9dc1f69953d551
MD5 30d2f29357611404b41e76a259b05150
BLAKE2b-256 eca861a6b986bf49e711a73203a1668e2f2e8470f212a6065b1f6131a5970224

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 00480887231fdaaad77fe4d9fdfd310e4d9471024d410ab0e21e7525946efd2b
MD5 b05f7e259f18d7ad3e1735d3eba0b079
BLAKE2b-256 bad50fe29a6a847ff2828faadf3e7b0f65a6d7408ed449c86b519ac3760cfd5a

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: cougar-0.5.13-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cougar-0.5.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7b3832f53c3b78fef52b4700d8c8be14db3b6ec9bf773601feb46cf92a4168bb
MD5 2e4894ad6c967993b9750ac297de023e
BLAKE2b-256 7fcd9927e46ee9009062f9f32064616b52201754dfe25c3378e59489bf431b17

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7240b77fd014540e494f844760f1bb3dd0b966edc2a9649f2ae334a3dcfeab5
MD5 b2d0d11ebc1e3227e8f5141c1a013e51
BLAKE2b-256 72fdec8963c78d45b46a286ea10733cc438147b1cba31781c9c60f7d4529fc8e

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f2486432ef6bc17cc576a7a66638f8546a7dfd20e50d1413b435029caceeaa76
MD5 3af8e637ba6f41dbd09f3873c0c88a05
BLAKE2b-256 3b969ed8e5aaaf15e060e02f0f110dfd626aaa17c6a371fef2da67d25abd28c6

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cougar-0.5.13-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cougar-0.5.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7e6bf08340e9ce8dac2bcc54d0c724bc0e386b289c05da52d4e8ec14ce973c3b
MD5 8e867406226d3b01ee515620b84fe293
BLAKE2b-256 6b3c0c6a9deec85212757a1257c2c7947026f6cebca6cad2c062800d6018b2f2

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bb0320e31502c7d57741640f970aa66480f0ee9496564b2831ffe30b0358a092
MD5 0f8f9d75d81c02fe5495c905fafa831d
BLAKE2b-256 4d6d775791f9bd386cd81a86d5054f043acd579f3e7f0ff422dac001178deba8

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 aafb0a4e846919912e347a0db8fea3f87d5b69272abb38db5dbf574cba9e63d9
MD5 4d1a52921e63321e37efab16bce508d8
BLAKE2b-256 44c180aa783dc8735e92bbe8101bd7a72cd7b63f432d5651df5567b4b4c579e7

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cougar-0.5.13-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cougar-0.5.13-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 43ca03f6c9dc54d3a91dea663ed65955eb19e4d2ba70f5ad1e50016e781a94df
MD5 31bd793563c2bb2ba695aef611bee1d1
BLAKE2b-256 bc055b65cc9660986442c126d3725847c8d520143aa90f223a017112c9fbf1d4

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d93583dd962157b1569398fab27037a09d511bcd00f06330709d29735fa1e486
MD5 9ffa4f8d34f0890c4d4d9aeea711f04c
BLAKE2b-256 08a4906591177a473096dd55edbc927e9e03b5270fa3153ae759e00de0fcd420

See more details on using hashes here.

File details

Details for the file cougar-0.5.13-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cougar-0.5.13-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cb6561467f84e5c8425394ae82f0f4b8d434c7e7f969d5129caf001244e4509d
MD5 50fcf96aa524d333708c16685e61a6f0
BLAKE2b-256 5d47714f13642e17a6f7b1fa54d67e0dee4be218b524fb97e05410606a860de9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page