# pandas-llm
pandas-llm is a lightweight Python library that extends pandas to allow querying datasets using OpenAI prompts. This powerful tool leverages the natural language processing capabilities of OpenAI to offer intuitive, language-based querying of your pandas dataframes.
## Installation
Install pandas-llm using pip:
```shell
pip install pandas-llm
```
## Features
- Query pandas dataframes using natural language prompts.
- Leverage the power of OpenAI's language models in your data analysis.
- Seamless integration with existing pandas functions.
## Usage
Here's a quick example of how to use pandas-llm:
```python
import os
import pandas as pd
# import sys
# from pathlib import Path
# sys.path.append(str(Path(__file__).resolve().parent.parent))
from pandas_llm import PandasLLM
# Data
# Please note that these names, ages, and donations are randomly generated
# and do not correspond to real individuals or their donations.
data = [('John Doe', 25, 50),
('Jane Smith', 38, 70),
('Alex Johnson', 45, 80),
('Jessica Brown', 60, 40),
('Michael Davis', 22, 90),
('Emily Wilson', 30, 60),
('Daniel Taylor', 35, 75),
('Sophia Moore', 40, 85),
('David Thomas', 50, 65),
('Olivia Jackson', 29, 55)]
df = pd.DataFrame(data, columns=['name', 'age', 'donation'])
conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"), verbose=True)
result = conv_df.prompt("What is the average donation of people older than 30 who donated more than $50?")
print(f"Result ({type(result)}):\n {result}")
# Result (<class 'numpy.float64'>):
# 75.0
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/DashyDashOrg/pandas-llm",
"name": "pandas-llm",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "pypi,pandas-llm,pandas,llm,ai,openai,chatgpt",
"author": "DashyDash",
"author_email": "alessio@dashydash.com",
"download_url": "https://files.pythonhosted.org/packages/46/61/ac1bd0d045ebe2ee80ce3dc2e8f05218068c361430d008bf2e78e0d3c682/pandas_llm-0.0.5.tar.gz",
"platform": null,
"description": "# pandas-llm\n\npandas-llm is a lightweight Python library that extends pandas to allow querying datasets using OpenAI prompts. This powerful tool leverages the natural language processing capabilities of OpenAI to offer intuitive, language-based querying of your pandas dataframes.\n\n## Installation\n\nInstall pandas-llm using pip:\n\n```shell\npip install pandas-llm\n```\n\n## Features\n- Query pandas dataframes using natural language prompts.\n- Leverage the power of OpenAI's language models in your data analysis.\n- Seamless integration with existing pandas functions.\n\n## Usage\nHere's a quick example of how to use pandas-llm:\n\n```python\nimport os\nimport pandas as pd\n\n# import sys\n# from pathlib import Path\n# sys.path.append(str(Path(__file__).resolve().parent.parent))\nfrom pandas_llm import PandasLLM\n\n# Data\n# Please note that these names, ages, and donations are randomly generated \n# and do not correspond to real individuals or their donations.\ndata = [('John Doe', 25, 50), \n ('Jane Smith', 38, 70),\n ('Alex Johnson', 45, 80),\n ('Jessica Brown', 60, 40),\n ('Michael Davis', 22, 90),\n ('Emily Wilson', 30, 60),\n ('Daniel Taylor', 35, 75),\n ('Sophia Moore', 40, 85),\n ('David Thomas', 50, 65),\n ('Olivia Jackson', 29, 55)]\ndf = pd.DataFrame(data, columns=['name', 'age', 'donation'])\n\nconv_df = PandasLLM(data=df, llm_api_key = os.environ.get(\"OPENAI_API_KEY\"), verbose=True)\nresult = conv_df.prompt(\"What is the average donation of people older than 30 who donated more than $50?\")\n\nprint(f\"Result ({type(result)}):\\n {result}\")\n# Result (<class 'numpy.float64'>):\n# 75.0\n```\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.\n\n## License\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Conversational Pandas Dataframes",
"version": "0.0.5",
"project_urls": {
"Bug Tracker": "https://github.com/DashyDashOrg/pandas-llm/issues",
"Download": "https://github.com/DashyDashOrg/pandas-llm/releases/tag/v0.0.5",
"Homepage": "https://github.com/DashyDashOrg/pandas-llm"
},
"split_keywords": [
"pypi",
"pandas-llm",
"pandas",
"llm",
"ai",
"openai",
"chatgpt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "231413c9b1236c7f8aa72cf0a35ee8f65933a05fbfe0c453b7c92c2bce31888e",
"md5": "750594148ca770b12fef7a389b9c14e0",
"sha256": "e9421518899a505f3cd6ec60ec6baeb3db351d388efe2f2ee74ae92e49421fbd"
},
"downloads": -1,
"filename": "pandas_llm-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "750594148ca770b12fef7a389b9c14e0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9443,
"upload_time": "2023-05-14T18:10:29",
"upload_time_iso_8601": "2023-05-14T18:10:29.466570Z",
"url": "https://files.pythonhosted.org/packages/23/14/13c9b1236c7f8aa72cf0a35ee8f65933a05fbfe0c453b7c92c2bce31888e/pandas_llm-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4661ac1bd0d045ebe2ee80ce3dc2e8f05218068c361430d008bf2e78e0d3c682",
"md5": "e962f1d74e57a99ebab2bd63a3dda4de",
"sha256": "aa5b492ef498821a5fb7d7ccf1fc5a80cf7c6dcabf9d7707006937ca34b02431"
},
"downloads": -1,
"filename": "pandas_llm-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "e962f1d74e57a99ebab2bd63a3dda4de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 8678,
"upload_time": "2023-05-14T18:10:31",
"upload_time_iso_8601": "2023-05-14T18:10:31.099146Z",
"url": "https://files.pythonhosted.org/packages/46/61/ac1bd0d045ebe2ee80ce3dc2e8f05218068c361430d008bf2e78e0d3c682/pandas_llm-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-14 18:10:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DashyDashOrg",
"github_project": "pandas-llm",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
"==",
"3.8.4"
]
]
},
{
"name": "aiosignal",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "async-timeout",
"specs": [
[
"==",
"4.0.2"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"23.1.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2023.5.7"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.1.0"
]
]
},
{
"name": "frozenlist",
"specs": [
[
"==",
"1.3.3"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.4"
]
]
},
{
"name": "multidict",
"specs": [
[
"==",
"6.0.4"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.24.3"
]
]
},
{
"name": "openai",
"specs": [
[
"==",
"0.27.6"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.8.2"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2023.3"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.30.0"
]
]
},
{
"name": "RestrictedPython",
"specs": [
[
"==",
"6.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
"==",
"4.65.0"
]
]
},
{
"name": "tzdata",
"specs": [
[
"==",
"2023.3"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.0.2"
]
]
},
{
"name": "yarl",
"specs": [
[
"==",
"1.9.2"
]
]
}
],
"lcname": "pandas-llm"
}