From 0ff060b0d56be500c70004b4d9c0474326e0e751 Mon Sep 17 00:00:00 2001 From: femtotrader Date: Wed, 7 Jan 2015 21:34:56 +0100 Subject: [PATCH] Add get_functions_df and get_functions_grouped_df https://github.com/mrjbq7/ta-lib/issues/67 --- talib/__init__.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/talib/__init__.py b/talib/__init__.py index dc6d7413d..9aa1b0228 100644 --- a/talib/__init__.py +++ b/talib/__init__.py @@ -215,4 +215,25 @@ def get_function_groups(): """ return __function_groups__.copy() -__all__ = ['get_functions', 'get_function_groups'] +def get_functions_df(): + """ + Returns a Pandas DataFrame of all the functions supported by TALIB + """ + import pandas as pd + lst_info = [] + for f in get_functions(): + absf = abstract.Function(f) + lst_info.append(absf.info) + df_absf = pd.DataFrame(lst_info) + df_absf = df_absf.set_index('name') + return(df_absf) + +def get_functions_grouped_df(): + """ + Returns a Pandas DataFrame of all the functions supported by TALIB grouped by "group" + """ + df_absf = get_functions_df() + df_grp = df_absf.reset_index().set_index(['group', 'name']).sortlevel(0) + return(df_grp) + +__all__ = ['get_functions', 'get_function_groups', 'get_functions_df', 'get_functions_grouped_df']