hana_ai.smart_dataframe

hana.ai smart_dataframe is a dataframe agent to perform HANA dataframe operations via natural language.

Smart DataFrame.

The following class is available:

  • :class SmartDataFrame

class hana_ai.smart_dataframe.SmartDataFrame(dataframe: DataFrame)

Smart DataFrame.

Parameters:
dataframeDataFrame

Dataframe.

Examples

>>> from hana_ai.smart_dataframe import SmartDataFrame
>>> sdf = SmartDataFrame(dataframe=hana_df)
>>> sdf.configure(llm=llm, verbose=True)
>>> sdf.ask(question="Show the samples of the dataset")
>>> new_sdf = sdf.transform(question="Get last two rows")
configure(llm: BaseLLM, tools: List[BaseTool] = None, verbose: bool = False, **kwargs)

Configure the Smart DataFrame.

Parameters:
llmBaseLLM

LLM.

toolkitList of BaseTool, optional

The dataframe toos to be used.

Defaults to df_tools.

ask(question: str)

Ask a question.

Parameters:
questionstr

Question.

verbosebool, optional

Verbose. Default to False.

transform(question: str, output_key='output')

Transform the dataframe.

Parameters:
questionstr

Question.

verbosebool, optional

Verbose. Default to False.