Install & Compatibility
Where this runs
tested against v0.3.16 · 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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.902s · 166.3MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 7.7s · import 0.865s · 159MB
166MB installed
● package 166MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ta
✓ import pandas as pd
import pandas_ta as ta
Common alias for both standalone functions and to enable the DataFrame accessor.
DataFrame.ta
✓ import pandas as pd
import pandas_ta as ta
df = pd.DataFrame() # Your DataFrame
df.ta.sma(length=10, append=True)
✗ from ft_pandas_ta import ta # Then df.ta.sma()
While 'from ft_pandas_ta import ta' might work for standalone functions, 'import pandas_ta as ta' is the canonical way to import the library and automatically enable the DataFrame '.ta' accessor. The 'ft_pandas_ta' package uses 'pandas_ta' as its internal module name.
This quickstart demonstrates fetching historical stock data using `yfinance`, then calculating a Simple Moving Average (SMA), Relative Strength Index (RSI), and Bollinger Bands using `ft-pandas-ta`. It showcases both appending indicators directly to the DataFrame and returning them as a Series.
import pandas as pd
import pandas_ta as ta
import yfinance as yf # Common dependency for fetching financial data
# Fetch sample financial data
df = yf.download('AAPL', start='2022-01-01', end='2023-01-01')
# Ensure the index is a DatetimeIndex (yfinance does this by default)
# For other data sources, you might need:
# df.index = pd.to_datetime(df.index)
# Calculate a Simple Moving Average (SMA) and append to DataFrame
df.ta.sma(length=20, append=True)
# Calculate Relative Strength Index (RSI) and get it as a Series
rsi_series = df.ta.rsi(length=14)
# Calculate Bollinger Bands and append multiple columns to DataFrame
df.ta.bbands(append=True)
print(df.tail())
print(rsi_series.tail())
Debug
Known issues
breakingOlder versions (prior to 0.3.16) might encounter `DeprecationWarning` related to `pkg_resources` due to changes in Python packaging.fixUpgrade to `ft-pandas-ta` version 0.3.16 or newer: `pip install --upgrade ft-pandas-ta`.
affects: <0.3.16
breakingWhen upgrading to NumPy 2.0+, older versions of `pandas-ta` (and potentially `ft-pandas-ta` if not on 0.3.16) may raise `ImportError: cannot import name 'NaN' from 'numpy'`. This is due to `numpy.NaN` being deprecated in favor of `numpy.nan`.fixUpgrade to `ft-pandas-ta` 0.3.16 or newer. If the error persists, consider downgrading NumPy to `numpy==1.26.3` or manually patching the `squeeze_pro.py` file (as detailed for original `pandas-ta`) by changing `from numpy import NaN as npNaN` to `from numpy import nan as npNaN` if your installed `ft-pandas-ta` version still contains this issue.
affects: Potentially <0.3.16 or specific environments with older NumPy.
gotchaSome indicators require specific DataFrame column names (e.g., 'open', 'high', 'low', 'close', 'volume'). If these columns are missing or incorrectly named, a `KeyError` will occur.fixEnsure your DataFrame contains the expected OHLCV columns, typically lowercased. Rename columns if necessary (e.g., `df.columns = df.columns.str.lower()`).
affects: All
breakingPandas 3.0 introduced significant changes to copy/view semantics, deprecating `SettingWithCopyWarning` and enforcing explicit modifications. Chained assignments like `df[df['col'] > 0]['new_col'] = value` no longer work reliably. This could affect how you manipulate DataFrames with `ft-pandas-ta` results.fixAdopt explicit modification patterns, especially using `.loc` for assignment: `df.loc[df['col'] > 0, 'new_col'] = value`. Understand the new Copy-on-Write behavior in Pandas 3.0.
affects: Pandas >=3.0
Errors
Common errors & fixes
ImportError: cannot import name 'NaN' from 'numpy'
The `ft-pandas-ta` library (or underlying `pandas-ta` module) is trying to import `NaN` from `numpy`, but modern NumPy (e.g., 2.0+) uses `nan` (lowercase).
fixUpgrade `ft-pandas-ta` to 0.3.16 or newer (`pip install --upgrade ft-pandas-ta`). If the problem persists, you might need to downgrade `numpy` to an older version like `numpy==1.26.3` or manually edit the problematic `ft-pandas-ta` source file if a fix isn't available.
KeyError: 'close'
An indicator function was called on a DataFrame, but the required 'close' column (or other OHLCV columns like 'open', 'high', 'low', 'volume') was not found.
fixVerify that your DataFrame has columns named 'open', 'high', 'low', 'close', 'volume' (case-insensitive for the `.ta` accessor but explicit calls require exact names). Rename columns if necessary (e.g., `df.columns = df.columns.str.lower()`).
AttributeError: 'DataFrame' object has no attribute 'ta'
The `pandas_ta` module was not imported, or it was imported in a way that did not activate the DataFrame extension. The `.ta` accessor is added to DataFrames upon importing `pandas_ta`.
fixEnsure you have `import pandas_ta as ta` (or similar) at the beginning of your script. This import statement activates the `.ta` accessor for all Pandas DataFrames.
TypeError: Cannot compare types '_____' and '_____' (for example, string and int) when performing operations involving indicator calculations.
Input columns for indicators contain mixed data types or non-numeric types (e.g., strings) where numbers are expected.
fixInspect the `dtypes` of your DataFrame columns, especially those used in indicator calculations. Convert relevant columns to numeric types (e.g., `pd.to_numeric(df['column'], errors='coerce')`) and handle any `NaN` values that result from coercion.
Upgrade
Version history
0.3.16latest on PyPI · released Sep 29, 2025
Audit
Dependencies
pandasrequiredCore data structure for time series and DataFrame extension.
numpyrequiredNumerical operations and array handling.