Skip to main content

Pandas AI Loader

pip install llama-index-readers-pandas-ai

This loader is a light wrapper around the PandasAI Python package.

See here: https://github.com/gventuri/pandas-ai.

You can directly get the result of pandasai.run command, or you can choose to load in Document objects via load_data.

Usage

from pandasai.llm.openai import OpenAI
import pandas as pd

# Sample DataFrame
df = pd.DataFrame(
    {
        "country": [
            "United States",
            "United Kingdom",
            "France",
            "Germany",
            "Italy",
            "Spain",
            "Canada",
            "Australia",
            "Japan",
            "China",
        ],
        "gdp": [
            21400000,
            2940000,
            2830000,
            3870000,
            2160000,
            1350000,
            1780000,
            1320000,
            516000,
            14000000,
        ],
        "happiness_index": [7.3, 7.2, 6.5, 7.0, 6.0, 6.3, 7.3, 7.3, 5.9, 5.0],
    }
)

llm = OpenAI()

from llama_index.readers.pandas_ai import PandasAIReader

# use run_pandas_ai directly
# set is_conversational_answer=False to get parsed output
loader = PandasAIReader(llm=llm)
response = reader.run_pandas_ai(
    df, "Which are the 5 happiest countries?", is_conversational_answer=False
)
print(response)

# load data with is_conversational_answer=False
# will use our PandasCSVReader under the hood
docs = reader.load_data(
    df, "Which are the 5 happiest countries?", is_conversational_answer=False
)

# load data with is_conversational_answer=True
# will use our PandasCSVReader under the hood
docs = reader.load_data(
    df, "Which are the 5 happiest countries?", is_conversational_answer=True
)

This loader is designed to be used as a way to load data into LlamaIndex.

Metadata

Release files for llama-index-readers-pandas-ai 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-readers-pandas-ai 0.5.1
File Size Uploaded Provenance Actions
llama_index_readers_pandas_ai-0.5.1.tar.gz 4.8 kB Without provenance Details for llama_index_readers_pandas_ai-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-pandas-ai 0.5.1
File Interpreter ABI Platform Actions
llama_index_readers_pandas_ai-0.5.1-py3-none-any.whl Python 3 none any Details for llama_index_readers_pandas_ai-0.5.1-py3-none-any.whl

Total release size: 9.2 kB

Release files / llama_index_readers_pandas_ai-0.5.1.tar.gz

Download URL llama_index_readers_pandas_ai-0.5.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
10001273c23d350aa42492f6ff2cc956735f07fb8eb099a3c6917d4671812e95
BLAKE2b-256 checksum
How to use checksums
59b7d5e3837ae310524b806e884cc3dc3d56cf5494a4cb09086916915bb60826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release files / llama_index_readers_pandas_ai-0.5.1-py3-none-any.whl

Download URL llama_index_readers_pandas_ai-0.5.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6030e94c87fcfc9f8af9e2a8f0b52e3d1da10b3b06e17b933792973397ffd343
BLAKE2b-256 checksum
How to use checksums
bfe6239d9f8f543c18214e76bcb2dbd6e5c28d1dc02ed2ba5e0e30a0af2d8d00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Security for llama-index-readers-pandas-ai 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page