Pandas TA Classic

raw JSON →
0.5.44 verified Fri May 01 auth: no python

A maintained fork of the popular pandas-ta library, providing an extensive collection of technical analysis indicators and TA-Lib patterns as Pandas DataFrame extensions. Current version is 0.5.44, with a monthly release cadence and active development.

pip install pandas-ta-classic
error ModuleNotFoundError: No module named 'pandas_ta'
cause Installed package as 'pandas-ta-classic' but imported as 'pandas_ta'? Or not installed.
fix
Run: pip install pandas-ta-classic, then import pandas_ta
error 'DataFrame' object has no attribute 'ta'
cause pandas_ta not imported or imported incorrectly.
fix
Ensure 'import pandas_ta as ta' is executed before using df.ta.
error ValueError: length must be greater than 0
cause Incorrect parameters passed to indicator (e.g., length=0 or negative).
fix
Check indicator parameters; e.g., df.ta.sma(length=10) requires length >= 2.
breaking pandas-ta-classic is a fork; breaking changes from original pandas-ta may exist. Always check migration guide.
fix Review changelog at https://github.com/xgboosted/pandas-ta-classic/releases
deprecated TA-Lib pattern functions are deprecated in favor of native pandas-ta implementations. TA-Lib must be installed separately if needed.
fix Use pandas-ta built-in patterns (e.g., df.ta.cdl_pattern(name='doji')) instead of TA-Lib.
gotcha Indicator methods may modify the DataFrame in-place even without append=True if the method is called with default kwargs.
fix Always pass append=True explicitly to avoid silent column overwrites.
gotcha Some indicators require specific column names (open, high, low, close, volume). Missing columns raise KeyError.
fix Rename columns to lowercase before using df.ta.

Calculate a simple moving average (SMA) and append it to the DataFrame.

import pandas as pd
import pandas_ta as ta

df = pd.DataFrame({'close': [1.1, 1.2, 1.3, 1.4, 1.5]})
df.ta.sma(length=4, append=True)
print(df)