{"id":5679,"library":"pandas-ta","title":"pandas-ta Technical Analysis Library","description":"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.","status":"active","version":"0.4.71b0","language":"python","source_language":"en","source_url":"https://github.com/twopirllc/pandas-ta","tags":["technical-analysis","pandas","financial-data","trading","quantitative-research"],"install":[{"cmd":"pip install pandas_ta","lang":"bash","label":"Install pandas-ta"}],"dependencies":[{"reason":"Core dependency; pandas-ta extends Pandas Dataframes.","package":"pandas","optional":false},{"reason":"Required by pandas for numerical operations.","package":"numpy","optional":false}],"imports":[{"note":"Standard import for accessing global functions and configuring the DataFrame accessor.","symbol":"pandas_ta","correct":"import pandas_ta as ta"}],"quickstart":{"code":"import pandas as pd\nimport pandas_ta as ta\nimport io\n\n# Sample financial data (usually loaded from CSV, API, etc.)\ndata = \"\"\"Open,High,Low,Close,Volume\n100,105,99,103,1000\n103,108,102,107,1200\n107,112,106,110,1100\n110,115,109,114,1300\n114,119,113,117,1400\n117,122,116,120,1500\n120,125,119,123,1600\n123,128,122,127,1700\n127,132,126,130,1800\n130,135,129,133,1900\n\"\"\"\ndf = pd.read_csv(io.StringIO(data))\n\n# Extend pandas with pandas-ta and apply a strategy\n# By default, indicators are not appended to the original DataFrame in v0.4+\n# Use append=True if you want to modify the original df, or reassign.\n# For quickstart, we'll demonstrate adding to a new df to show the result clearly\n\n# Apply a single indicator (e.g., Simple Moving Average)\ndf['SMA_10'] = ta.sma(df['Close'], length=3) # Example length\n\n# Apply a full strategy (e.g., 'All' or a custom one)\n# By default, 'append=False' in v0.4+ for df.ta accessor.\n# Let's create a new DataFrame to show the strategy results cleanly.\nstrat_df = df.copy()\nstrat_df.ta.strategy(\"All\") # Applies a set of common indicators\n\nprint(\"DataFrame with SMA:\")\nprint(df.tail())\nprint(\"\\nDataFrame with 'All' strategy indicators (new columns only):\")\nprint(strat_df.tail())\n# To see only the newly added columns for strategy:\n# print(strat_df.drop(columns=['Open', 'High', 'Low', 'Close', 'Volume']).tail())","lang":"python","description":"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."},"warnings":[{"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'])`.","message":"The 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.","severity":"breaking","affected_versions":">=0.4.0"},{"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.","message":"The `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.","severity":"breaking","affected_versions":">=0.4.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All `0.4.x` beta releases"},{"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).","message":"Many 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.","severity":"gotcha","affected_versions":"All"},{"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.","message":"Default 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'0.4.71':55 '3':14 'activ':59 'analysi':5,18,66 'api':43 'appli':45 'b0':56 'beta':57 'comprehens':12 'current':52 'data':70 'datafram':21,50 'design':30 'develop':60 'direct':48 'easi':40 'easy-to-us':39 'extend':19 'financi':46,69 'financial-data':68 'frequent':62 'indic':27,47,58 'investor':36 'librari':6,15 'panda':2,8,20,67 'pandas-ta':1,7 'provid':37 'python':13 'quantit':32,73 'quantitative-research':72 'rang':25 'research':33,74 'ta':3,9 'technic':4,17,65 'technical-analysi':64 'trade':71 'trader':34 'updat':63 'use':42 'version':53 'wide':24","created_at":"2026-04-14T03:39:05.366824+00:00","updated_at":"2026-04-16T17:52:17.534845+00:00","problems":[{"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`).","cause":"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.","error":"ImportError: cannot import name 'NaN' from 'numpy'"},{"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.","cause":"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.","error":"AttributeError: 'Series' object has no attribute 'append'"},{"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()`.","cause":"The `.ta` accessor is a DataFrame extension, meaning it can only be called directly on a Pandas DataFrame object, not on a single Series.","error":"AttributeError: 'Series' object has no attribute 'ta'"},{"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.","cause":"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).","error":"KeyError: 'COLUMN_NAME' (e.g., 'CCI_20_2.0', 'Close')"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.4.71b0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.pandas-ta.dev","github":"https://github.com/twopirllc/pandas-ta","docs":"https://www.pandas-ta.dev/api","changelog":null,"pypi":"https://pypi.org/project/pandas-ta/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}