Skip to content

describe_data and the other AI description helpers still run on pandas #2041

Description

@ghostiee-11

#2008 made describe_data accept any narwhals frame, but it converts on entry at ai/utils.py:784 and the ~200 lines below it are pandas. The conversion was deliberately put in one place during that review so it could be lifted later, which is what this is.

Two smaller helpers in the same category still take pandas only:

  • format_exploration_result (ai/agents/sql.py:128), fed by BaseSQLSource.execute which is contracted to return pandas
  • sanitize_column_names (ai/utils.py:1769), used by the DeckGL agent

Moving these onto narwhals would let a polars or pyarrow source reach the LLM context without a copy. describe_data is the one worth doing first since it is on the hot path.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions