pandasai


Namepandasai JSON
Version 2.0.37 PyPI version JSON
download
home_pageNone
SummaryChat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
upload_time2024-05-05 22:33:22
maintainerNone
docs_urlNone
authorGabriele Venturi
requires_python!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,!=3.8.*,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ![PandasAI](images/logo.png)

[![Release](https://img.shields.io/pypi/v/pandasai?label=Release&style=flat-square)](https://pypi.org/project/pandasai/)
[![CI](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)
[![CD](https://github.com/gventuri/pandas-ai/actions/workflows/cd.yml/badge.svg)](https://github.com/gventuri/pandas-ai/actions/workflows/cd.yml/badge.svg)
[![Coverage](https://codecov.io/gh/gventuri/pandas-ai/branch/main/graph/badge.svg)](https://codecov.io/gh/gventuri/pandas-ai)
[![Documentation Status](https://readthedocs.org/projects/pandas-ai/badge/?version=latest)](https://pandas-ai.readthedocs.io/en/latest/?badge=latest)
[![Discord](https://dcbadge.vercel.app/api/server/kF7FqH2FwS?style=flat&compact=true)](https://discord.gg/kF7FqH2FwS)
[![Downloads](https://static.pepy.tech/badge/pandasai)](https://pepy.tech/project/pandasai) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)

PandasAI is a Python library that makes it easy to ask questions to your data in natural language. It helps you to explore, clean, and analyze your data using generative AI.

# 🔧 Getting started

The documentation for PandasAI to use it with specific LLMs, vector stores and connectors, can be found [here](https://pandas-ai.readthedocs.io/en/latest/).

## 📦 Installation

With pip:

```bash
pip install pandasai
```

With poetry:

```bash
poetry add pandasai
```

## 🔍 Demo

Try out PandasAI yourself in your browser:

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)

# 🚀 Deploying PandasAI

PandasAI can be deployed in a variety of ways. You can easily use it in your Jupyter notebooks or streamlit apps, or you can deploy it as a REST API such as with FastAPI or Flask.

If you are interested in managed PandasAI Cloud or self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).

## 💻 Usage

### Ask questions

```python
import os
import pandas as pd
from pandasai import Agent

# Sample DataFrame
sales_by_country = pd.DataFrame({
    "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
    "sales": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})

# By default, unless you choose a different LLM, it will use BambooLLM.
# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)
os.environ["PANDASAI_API_KEY"] = "YOUR_API_KEY"

agent = Agent(sales_by_country)
agent.chat('Which are the top 5 countries by sales?')
```

```
China, United States, Japan, Germany, Australia
```

---

Or you can ask more complex questions:

```python
agent.chat(
    "What is the total sales for the top 3 countries by sales?"
)
```

```
The total sales for the top 3 countries by sales is 16500.
```

### Visualize charts

You can also ask PandasAI to generate charts for you:

```python
agent.chat(
    "Plot the histogram of countries showing for each the gdp, using different colors for each bar",
)
```

![Chart](images/histogram-chart.png?raw=true)

### Multiple DataFrames

You can also pass in multiple dataframes to PandasAI and ask questions relating them.

```python
import os
import pandas as pd
from pandasai import Agent

employees_data = {
    'EmployeeID': [1, 2, 3, 4, 5],
    'Name': ['John', 'Emma', 'Liam', 'Olivia', 'William'],
    'Department': ['HR', 'Sales', 'IT', 'Marketing', 'Finance']
}

salaries_data = {
    'EmployeeID': [1, 2, 3, 4, 5],
    'Salary': [5000, 6000, 4500, 7000, 5500]
}

employees_df = pd.DataFrame(employees_data)
salaries_df = pd.DataFrame(salaries_data)

# By default, unless you choose a different LLM, it will use BambooLLM.
# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)
os.environ["PANDASAI_API_KEY"] = "YOUR_API_KEY"

agent = Agent([employees_df, salaries_df])
agent.chat("Who gets paid the most?")
```

```
Olivia gets paid the most.
```

You can find more examples in the [examples](examples) directory.

## 🔒 Privacy & Security

In order to generate the Python code to run, we take some random samples from the dataframe, we randomize it (using random generation for sensitive data and shuffling for non-sensitive data) and send just the randomized head to the LLM.

If you want to enforce further your privacy you can instantiate PandasAI with `enforce_privacy = True` which will not send the head (but just column names) to the LLM.

## 📜 License

PandasAI is available under the MIT expat license, except for the `pandasai/ee` directory (which has it's [license here](https://github.com/Sinaptik-AI/pandas-ai/blob/master/pandasai/ee/LICENSE) if applicable.

If you are interested in managed PandasAI Cloud or self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).

## Resources

- [Docs](https://pandas-ai.readthedocs.io/en/latest/) for comprehensive documentation
- [Examples](examples) for example notebooks
- [Discord](https://discord.gg/kF7FqH2FwS) for discussion with the community and PandasAI team

## 🤝 Contributing

Contributions are welcome! Please check the outstanding issues and feel free to open a pull request.
For more information, please check out the [contributing guidelines](CONTRIBUTING.md).

### Thank you!

[![Contributors](https://contrib.rocks/image?repo=gventuri/pandas-ai)](https://github.com/gventuri/pandas-ai/graphs/contributors)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pandasai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,!=3.8.*,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Gabriele Venturi",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/94/96/ef36ea64075ad6273b5ed25b3e6a9f47cbfd067311540d2ba39c183c7d17/pandasai-2.0.37.tar.gz",
    "platform": null,
    "description": "# ![PandasAI](images/logo.png)\n\n[![Release](https://img.shields.io/pypi/v/pandasai?label=Release&style=flat-square)](https://pypi.org/project/pandasai/)\n[![CI](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)\n[![CD](https://github.com/gventuri/pandas-ai/actions/workflows/cd.yml/badge.svg)](https://github.com/gventuri/pandas-ai/actions/workflows/cd.yml/badge.svg)\n[![Coverage](https://codecov.io/gh/gventuri/pandas-ai/branch/main/graph/badge.svg)](https://codecov.io/gh/gventuri/pandas-ai)\n[![Documentation Status](https://readthedocs.org/projects/pandas-ai/badge/?version=latest)](https://pandas-ai.readthedocs.io/en/latest/?badge=latest)\n[![Discord](https://dcbadge.vercel.app/api/server/kF7FqH2FwS?style=flat&compact=true)](https://discord.gg/kF7FqH2FwS)\n[![Downloads](https://static.pepy.tech/badge/pandasai)](https://pepy.tech/project/pandasai) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)\n\nPandasAI is a Python library that makes it easy to ask questions to your data in natural language. It helps you to explore, clean, and analyze your data using generative AI.\n\n# \ud83d\udd27 Getting started\n\nThe documentation for PandasAI to use it with specific LLMs, vector stores and connectors, can be found [here](https://pandas-ai.readthedocs.io/en/latest/).\n\n## \ud83d\udce6 Installation\n\nWith pip:\n\n```bash\npip install pandasai\n```\n\nWith poetry:\n\n```bash\npoetry add pandasai\n```\n\n## \ud83d\udd0d Demo\n\nTry out PandasAI yourself in your browser:\n\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)\n\n# \ud83d\ude80 Deploying PandasAI\n\nPandasAI can be deployed in a variety of ways. You can easily use it in your Jupyter notebooks or streamlit apps, or you can deploy it as a REST API such as with FastAPI or Flask.\n\nIf you are interested in managed PandasAI Cloud or self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).\n\n## \ud83d\udcbb Usage\n\n### Ask questions\n\n```python\nimport os\nimport pandas as pd\nfrom pandasai import Agent\n\n# Sample DataFrame\nsales_by_country = pd.DataFrame({\n    \"country\": [\"United States\", \"United Kingdom\", \"France\", \"Germany\", \"Italy\", \"Spain\", \"Canada\", \"Australia\", \"Japan\", \"China\"],\n    \"sales\": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]\n})\n\n# By default, unless you choose a different LLM, it will use BambooLLM.\n# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)\nos.environ[\"PANDASAI_API_KEY\"] = \"YOUR_API_KEY\"\n\nagent = Agent(sales_by_country)\nagent.chat('Which are the top 5 countries by sales?')\n```\n\n```\nChina, United States, Japan, Germany, Australia\n```\n\n---\n\nOr you can ask more complex questions:\n\n```python\nagent.chat(\n    \"What is the total sales for the top 3 countries by sales?\"\n)\n```\n\n```\nThe total sales for the top 3 countries by sales is 16500.\n```\n\n### Visualize charts\n\nYou can also ask PandasAI to generate charts for you:\n\n```python\nagent.chat(\n    \"Plot the histogram of countries showing for each the gdp, using different colors for each bar\",\n)\n```\n\n![Chart](images/histogram-chart.png?raw=true)\n\n### Multiple DataFrames\n\nYou can also pass in multiple dataframes to PandasAI and ask questions relating them.\n\n```python\nimport os\nimport pandas as pd\nfrom pandasai import Agent\n\nemployees_data = {\n    'EmployeeID': [1, 2, 3, 4, 5],\n    'Name': ['John', 'Emma', 'Liam', 'Olivia', 'William'],\n    'Department': ['HR', 'Sales', 'IT', 'Marketing', 'Finance']\n}\n\nsalaries_data = {\n    'EmployeeID': [1, 2, 3, 4, 5],\n    'Salary': [5000, 6000, 4500, 7000, 5500]\n}\n\nemployees_df = pd.DataFrame(employees_data)\nsalaries_df = pd.DataFrame(salaries_data)\n\n# By default, unless you choose a different LLM, it will use BambooLLM.\n# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)\nos.environ[\"PANDASAI_API_KEY\"] = \"YOUR_API_KEY\"\n\nagent = Agent([employees_df, salaries_df])\nagent.chat(\"Who gets paid the most?\")\n```\n\n```\nOlivia gets paid the most.\n```\n\nYou can find more examples in the [examples](examples) directory.\n\n## \ud83d\udd12 Privacy & Security\n\nIn order to generate the Python code to run, we take some random samples from the dataframe, we randomize it (using random generation for sensitive data and shuffling for non-sensitive data) and send just the randomized head to the LLM.\n\nIf you want to enforce further your privacy you can instantiate PandasAI with `enforce_privacy = True` which will not send the head (but just column names) to the LLM.\n\n## \ud83d\udcdc License\n\nPandasAI is available under the MIT expat license, except for the `pandasai/ee` directory (which has it's [license here](https://github.com/Sinaptik-AI/pandas-ai/blob/master/pandasai/ee/LICENSE) if applicable.\n\nIf you are interested in managed PandasAI Cloud or self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).\n\n## Resources\n\n- [Docs](https://pandas-ai.readthedocs.io/en/latest/) for comprehensive documentation\n- [Examples](examples) for example notebooks\n- [Discord](https://discord.gg/kF7FqH2FwS) for discussion with the community and PandasAI team\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please check the outstanding issues and feel free to open a pull request.\nFor more information, please check out the [contributing guidelines](CONTRIBUTING.md).\n\n### Thank you!\n\n[![Contributors](https://contrib.rocks/image?repo=gventuri/pandas-ai)](https://github.com/gventuri/pandas-ai/graphs/contributors)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.",
    "version": "2.0.37",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e109feb58f9b4417e4d7c54c845cb73dc282945d63489b08c504598359669c7",
                "md5": "92d3e2184ade25fba78d8e0eff4fd609",
                "sha256": "16ab0c1cf19a6bcd6ecca53d4925a019952409ad3b4382a61e79a2df16744ee9"
            },
            "downloads": -1,
            "filename": "pandasai-2.0.37-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92d3e2184ade25fba78d8e0eff4fd609",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,!=3.8.*,>=3.9",
            "size": 142501,
            "upload_time": "2024-05-05T22:33:18",
            "upload_time_iso_8601": "2024-05-05T22:33:18.692957Z",
            "url": "https://files.pythonhosted.org/packages/5e/10/9feb58f9b4417e4d7c54c845cb73dc282945d63489b08c504598359669c7/pandasai-2.0.37-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9496ef36ea64075ad6273b5ed25b3e6a9f47cbfd067311540d2ba39c183c7d17",
                "md5": "a1e15e6edb12607a70c91bc4d24d8f95",
                "sha256": "6e2c59d954e6e474afd2308953a46f1bdbdbb8af469adf64a1fb648b7c3667a3"
            },
            "downloads": -1,
            "filename": "pandasai-2.0.37.tar.gz",
            "has_sig": false,
            "md5_digest": "a1e15e6edb12607a70c91bc4d24d8f95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,!=3.8.*,>=3.9",
            "size": 91295,
            "upload_time": "2024-05-05T22:33:22",
            "upload_time_iso_8601": "2024-05-05T22:33:22.206913Z",
            "url": "https://files.pythonhosted.org/packages/94/96/ef36ea64075ad6273b5ed25b3e6a9f47cbfd067311540d2ba39c183c7d17/pandasai-2.0.37.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-05 22:33:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pandasai"
}
        
Elapsed time: 0.27541s