-
Notifications
You must be signed in to change notification settings - Fork 3
Add pandas DataFrame extension accessor (.ta) for technical indicators #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: deepentropy <8287111+deepentropy@users.noreply.github.com>
…t pandas installation Co-authored-by: deepentropy <8287111+deepentropy@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request implements a pandas DataFrame extension accessor (.ta) that provides seamless integration for calculating and appending 136+ technical indicators directly to DataFrames, mirroring the pandas-ta API pattern.
Key Changes:
- New pandas accessor enables
df.ta.sma()style indicator calculations - Automatic case-insensitive OHLCV column detection supporting multiple naming conventions
- Flexible
append=True/Falseparameter to either modify DataFrames in-place or return Series/DataFrame results
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/numta/pandas_ext.py |
Implements TAAccessor class with 136+ indicator methods, column auto-detection, and TA-Lib-compatible naming conventions |
src/numta/__init__.py |
Auto-registers the .ta accessor by importing pandas_ext module |
pyproject.toml |
Adds pandas as optional dependency under [pandas] extra and creates [all] extra group |
tests/test_pandas_ext.py |
Comprehensive test suite covering all indicator categories, edge cases, and API behavior |
README.md |
Adds "Pandas Integration" documentation section with usage examples and migration guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|
|
||
| ### Migration from pandas-ta | ||
|
|
||
| If you're migrating from pandas-ta (abandoned since 2019), numta provides a compatible API: |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The claim that pandas-ta was "abandoned since 2019" appears to be inaccurate. The pandas-ta library (twopirllc/pandas-ta on GitHub) has had active development beyond 2019, with the last release being in 2022. Consider revising this to simply state the migration benefits without making potentially inaccurate claims about the other library's maintenance status.
| If you're migrating from pandas-ta (abandoned since 2019), numta provides a compatible API: | |
| If you're migrating from pandas-ta, numta provides a compatible API: |
| "numba>=0.56.0", # JIT compilation for faster execution | ||
| ] | ||
| all = [ | ||
| "pandas>=1.3.0", |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The "all" optional dependency group appears incomplete. It should include all optional dependencies (comparison, numba) or be more clearly named to indicate it only includes specific extras. Consider either:
- Renaming to "dev-full" or similar to clarify scope
- Including all optional dependencies: pandas, numba, comparison, pytest packages
| "pandas>=1.3.0", | |
| "pandas>=1.3.0", | |
| "numba>=0.56.0", | |
| "TA-Lib>=0.4.0", |
| if not isinstance(result, tuple): | ||
| result = (result,) | ||
|
|
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Potential logic issue in _append_or_return: When column_names is a string, line 130 converts result to a tuple if it's not already one. However, lines 132-133 do the same check again. This creates redundant logic. While it shouldn't cause incorrect behavior (since the second check will see result is already a tuple), the code could be simplified by removing lines 132-133 since the tuple conversion is already handled in line 130 when needed.
| if not isinstance(result, tuple): | |
| result = (result,) | |
Implements a pandas DataFrame accessor mirroring pandas-ta's API, enabling direct calculation and appending of technical indicators to DataFrames.
Changes
src/numta/pandas_ext.py- NewTAAccessorclass with:open,Open,o, etc.)append=True/Falseparameter to append columns or return Series/DataFrameSMA_20,MACD_12_26_9,BBU_20_2.0)src/numta/__init__.py- Auto-registers accessor on importpyproject.toml- Addedpandasoptional dependencytests/test_pandas_ext.py- 38 tests covering all indicator categoriesREADME.md- Pandas Integration documentation sectionUsage
Install with:
pip install "numta[pandas]"Original prompt
Overview
Implement a pandas DataFrame extension accessor (
.ta) to mirror the functionality found in pandas-ta. This allows seamless calculation and appending of technical indicators directly to a Pandas DataFrame, ensuring a modern, frictionless user experience for algorithmic trading workflows.Motivation
Current Codebase Context
Project Structure
Current Indicator Signatures (from src/numta/api/overlap.py)
All Available Indicators (from src/numta/init.py)