About An advanced Python library implementing Kadane’s Algorithm with support for 1D & 2D arrays, visualization, subarray constraints, and test coverage. Perfect for data analysis, time-series problems, and algorithm enthusiasts.
Project description
kadane-adv: Advanced Subarray Optimization Library for Python
kadane-adv is a Python package that extends the classic Kadane’s Algorithm to support advanced use cases in 1D and 2D data analysis. Designed for performance and simplicity, it provides efficient tools to identify optimal subarrays and submatrices across diverse datasets—time series, financial data, sensor logs, or image matrices.
It is an essential utility for data analysts, researchers, and machine learning developers seeking meaningful patterns in structured data.
Table of Contents
- Main Features
- Installation
- Dependencies
- License
- Documentation
- Background
- Getting Help
- Discussion & Development
- Contributing
Main Features
-
🔹 1D Maximum Subarray Detection
Find the subarray with the maximum sum in linear time. -
🔹 2D Maximum Submatrix Detection
Extend Kadane’s algorithm to rectangular regions in 2D matrices. -
🔹 Constrained Optimization
Support for constraints such as minimum subarray length. -
🔹 Built-in Visualization
Visual representation of the detected optimal regions. -
🔹 Integration with NumPy & Pandas
Supports direct use of NumPy arrays and Pandas DataFrames. -
🔹 Real-world Applications
Use it in financial trend analysis, signal processing, sensor logs, and image matrix optimization.
Installation
From PyPI
You can install the library using pip:
pip install kadane-adv
From Source
- Download the source code from PyPI or GitHub.
- Extract the archive and navigate to the folder.
cd kadane-adv
- Run the setup script:
python setup.py install
Dependencies
Required:
numpy— for matrix and array operationsmatplotlib— for visualizations
Optional:
pandas— for seamless DataFrame integration
Exact versions can be found in the
requirements.txtfile.
License
Licensed under the MIT License.
See the LICENSE file for full text.
Documentation
- All functions are documented with Python docstrings
- Fully commented source code
- Use the built-in
help()function or your IDE's documentation viewer
Background
While classic Kadane’s algorithm finds the maximum sum subarray in 1D, kadane-adv extends this by adding:
- Multi-dimensional support (e.g., 2D submatrices)
- Constraint-based searches (e.g., min length)
- Visual feedback to verify or interpret the result
Typical Use Cases:
- Stock market and financial data analysis
- Time series segmentation
- Signal and anomaly detection
- Image processing and matrix evaluation
- Sensor data analysis for IoT applications
Getting Help
- Use
help(kadane_adv.function_name)in Python - Browse built-in examples (if available)
- Open an issue on the GitHub repo (link to be added)
Discussion & Development
The project evolves with real-world needs in:
- Data Science & ML workflows
- Financial and signal analysis
- Academic & exploratory research
Your suggestions and use-cases are welcome!
Contributing to kadane-adv
We welcome contributions in all forms! You can help by:
- Fixing bugs
- Adding new features
- Improving documentation
- Creating real-world usage examples
Guidelines:
- Keep changes focused and lightweight
- Write clear, readable, and commented code
- Use docstrings for new functions
- Submit a pull request (PR) with a clear description
Let’s make this tool better — together!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kadane_adv-1.1.0.tar.gz.
File metadata
- Download URL: kadane_adv-1.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4cb93f59174fd3c470de6af7cceb7482c0093ff60a4e2eb0da0a6937256c76e
|
|
| MD5 |
c26719440e8bb796995cd38bedc889a2
|
|
| BLAKE2b-256 |
812f52422eaa5abd2e5d452042ffb49ea0a6b9f0b84bafcd54f8edce427fcbd5
|
File details
Details for the file kadane_adv-1.1.0-py3-none-any.whl.
File metadata
- Download URL: kadane_adv-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ce8e817eb0249ab7f61556f15e21491fc72bac1ff2c601126081db45e6f1af
|
|
| MD5 |
8c65688102eade200c1ba9464a016d1c
|
|
| BLAKE2b-256 |
5843544b67949808f2c3f4ca750fa9f316e6ffba0340495550a743d4a1781273
|