Registry / data / pandas-ta

pandas-ta

JSON →
library0.4.71b0pypypi✓ verified 22d ago

pandas-ta is a comprehensive Python 3 library for technical analysis, extending Pandas Dataframes with a wide range of indicators. It's designed for quantitative researchers, traders, and investors, providing an easy-to-use API for applying financial indicators directly to Dataframes. The current version is 0.4.71b0 (beta), indicating active development and frequent updates.

pip install pandas_ta
INSTALL
IMPORT
SIG · PANDAS-TA
P
pandas-ta
datapythonv0.4.71b0
Install
10.8s avg
Import
1760ms
Disk
320MB
Pass rate
2/ 10
Env Coverage2 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.71b0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✕ build_error
✓ 11s
py 3.13
✕ build_error
✓ 10.7s
py 3.9
✕ build_error
✕ build_error
320MB installed
● package 320MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pandas_ta
import pandas_ta as ta
Standard import for accessing global functions and configuring the DataFrame accessor.

This quickstart demonstrates how to load sample data, apply a single technical indicator (SMA) directly, and then use the `df.ta.strategy()` method to apply a collection of indicators. Note the behavior of `append=False` by default in `0.4.x` versions, meaning indicators are not automatically added to the original DataFrame unless explicitly handled.

import pandas as pd import pandas_ta as ta import io # Sample financial data (usually loaded from CSV, API, etc.) data = """Open,High,Low,Close,Volume 100,105,99,103,1000 103,108,102,107,1200 107,112,106,110,1100 110,115,109,114,1300 114,119,113,117,1400 117,122,116,120,1500 120,125,119,123,1600 123,128,122,127,1700 127,132,126,130,1800 130,135,129,133,1900 """ df = pd.read_csv(io.StringIO(data)) # Extend pandas with pandas-ta and apply a strategy # By default, indicators are not appended to the original DataFrame in v0.4+ # Use append=True if you want to modify the original df, or reassign. # For quickstart, we'll demonstrate adding to a new df to show the result clearly # Apply a single indicator (e.g., Simple Moving Average) df['SMA_10'] = ta.sma(df['Close'], length=3) # Example length # Apply a full strategy (e.g., 'All' or a custom one) # By default, 'append=False' in v0.4+ for df.ta accessor. # Let's create a new DataFrame to show the strategy results cleanly. strat_df = df.copy() strat_df.ta.strategy("All") # Applies a set of common indicators print("DataFrame with SMA:") print(df.tail()) print("\nDataFrame with 'All' strategy indicators (new columns only):") print(strat_df.tail()) # To see only the newly added columns for strategy: # print(strat_df.drop(columns=['Open', 'High', 'Low', 'Close', 'Volume']).tail())
Debug
Known issues
breakingThe default behavior of `append` for the `df.ta` accessor changed from `True` to `False` in version 0.4.0. Previously, applying `df.ta.indicator()` or `df.ta.strategy()` would directly add new columns to the original DataFrame. Now, you must explicitly pass `append=True` to modify the original DataFrame, or capture the output of individual indicator functions.
fix
If you relied on indicators being appended, either explicitly call `df.ta.strategy(append=True)` or `df.ta.indicator(append=True)`. Alternatively, for individual indicators, assign their output to new DataFrame columns: `df['NEW_COL'] = ta.indicator(df['Close'])`.
affects: >=0.4.0
breakingThe `df.ta.strategy()` method underwent significant changes in 0.4.0. Its arguments and internal logic for applying multiple indicators were refactored. Older custom strategies or direct calls to `df.ta.strategy` might no longer work as expected without modification.
fix
Review the `pandas-ta` documentation for the `df.ta.strategy()` method in `0.4.x`. You may need to update your custom strategy definitions or adapt calls to match the new API. Simple string strategies like `"All"` generally still work but respect the `append=False` default.
affects: >=0.4.0
gotchaThe library is currently in a beta release series (e.g., `0.4.71b0`). While generally stable, this indicates ongoing development, and minor API adjustments or behavior changes might occur between beta versions or upon a full `0.4.x` stable release.
fix
Pin your `pandas-ta` version in `requirements.txt` (`pandas-ta==0.4.71b0`) to ensure consistent behavior in production environments. Regularly check the GitHub releases and changelog for updates before upgrading.
affects: All `0.4.x` beta releases
gotchaMany technical indicators require specific columns (e.g., 'Open', 'High', 'Low', 'Close', 'Volume') to be present in the DataFrame. Missing or incorrectly named columns will raise `KeyError` or produce incorrect results/NaNs.
fix
Ensure your DataFrame column names match the expected input (case-sensitive) for the indicators you are using. Use `df.rename(columns={'old_name': 'Close'})` if necessary. Also, ensure appropriate data types (e.g., numeric for prices/volume).
affects: All
gotchaDefault parameters (e.g., `length`, `period`, `std_dev`) for indicators might not always align with your trading strategy or analysis needs. Relying solely on defaults can lead to unexpected results.
fix
Always explicitly pass the desired parameters to indicator functions (e.g., `ta.sma(df['Close'], length=20)`). Familiarize yourself with common parameter values for each indicator and adjust as needed for your analysis.
affects: All
Errors
Common errors & fixes
ImportError: cannot import name 'NaN' from 'numpy'
This error occurs because newer versions of NumPy (2.0+) have changed the capitalization of `NaN` to `nan`, and `pandas-ta` versions prior to recent updates were hardcoded to import `NaN`, leading to an incompatibility.
fix
Downgrade NumPy to a compatible version (e.g., `pip install numpy==1.26.3`) or update `pandas-ta` to its latest development branch if a fix has been implemented there (`pip install -U git+https://github.com/twopirllc/pandas-ta.git@development`).
AttributeError: 'Series' object has no attribute 'append'
This error arises when `pandas-ta` (or code interacting with it) attempts to use the `Series.append()` method, which has been deprecated and removed in Pandas 2.0 and later versions.
fix
Downgrade your Pandas library to a version prior to 2.0 (e.g., `pip install pandas==1.5.3`). Alternatively, for a temporary workaround without downgrading Pandas, you can add `pd.Series.append = pd.Series._append` at the beginning of your script, though updating `pandas-ta` or using `pd.concat` where applicable is a more robust solution.
AttributeError: 'Series' object has no attribute 'ta'
The `.ta` accessor is a DataFrame extension, meaning it can only be called directly on a Pandas DataFrame object, not on a single Series.
fix
Ensure you are calling `.ta` on a DataFrame, not a Series. If you intend to calculate an indicator on a specific column, pass that Series to the `pandas_ta` function directly (e.g., `ta.macd(df['close'])`) or ensure the DataFrame has the necessary columns and call `df.ta.indicator()`.
KeyError: 'COLUMN_NAME' (e.g., 'CCI_20_2.0', 'Close')
This error typically occurs when `pandas-ta` functions expect specific input column names (like 'open', 'high', 'low', 'close', 'volume' in lowercase) that are not present in your DataFrame, or when you try to access an indicator's output column using an incorrect name (e.g., due to case sensitivity or not knowing the exact naming convention of the generated column).
fix
Verify that your DataFrame's OHLCV (Open, High, Low, Close, Volume) columns are correctly named, often in lowercase, or explicitly pass the correct column names to the `pandas-ta` function (e.g., `df.ta.cci(close='MyCloseColumn')`). For output columns, inspect the DataFrame after running the indicator to confirm the exact column names generated by `pandas-ta`. You can use `df.columns.tolist()` to see all available columns.
Upgrade
Version history
0.4.71b0latest on PyPI · released Sep 14, 2025
Audit
Dependencies
pandasrequiredCore dependency; pandas-ta extends Pandas Dataframes.
numpyrequiredRequired by pandas for numerical operations.
Agent activity
24 hits · last 30 days
node
18
Resources
pandas-ta — pip install pandas-ta · libregistry