pandas-chat


Namepandas-chat JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/torshind/pandas-ai
Summarypandas-ai is a python library that uses ChatGPT prompts to analyze and process pandas data in a conversational way.
upload_time2023-05-06 16:57:33
maintainer
docs_urlNone
authortorshind
requires_python
licenseBSD 3-Clause
keywords pandas chatgpt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pandas-chat
pandas-chat is a python library that uses LLMs prompts to analyze and process pandas data in a conversational way.

# Installation
You can install pandas-chat using pip:
```
pip install pandas-chat
```

# LLMs supported
`api="openai"`

`api="hugchat"`
# Usage example
## Creation
### Input
```
import numpy as np
import pandas as pd
from pandas_chat.action import Action

action = Action(
    api="openai",
    api_key="API_KEY",
)

X1 = pd.DataFrame(np.random.rand(10, 3), columns=["col1", "col2", "col3"])
X2 = pd.DataFrame(np.random.rand(10, 3), columns=["col1", "col2", "col3"])
func = np.square
prompt = "apply function func to X1 and then subtract X2 from X1"

X = action.create_and_run(
    prompt=prompt,
    X1=X1,
    X2=X2,
    func=func,
)
print(action)
```
### Output
```
Reply with a python module using pandas; this module will have one function with arguments X1, X2, func; this function will perform what is described by the following instructions delimited by <<< and >>>; <<<apply function func to X1 and then subtract X2 from X1>>>;
verify that the reply has all the necessary imports, that it contains only valid python code, and that the keywords used are present in the official documentation of the libraries from which they came;
don't include any explanations in your reply, returning only python code.

import pandas as pd

def apply_func(X1, X2, func):
    result = X1.apply(func) - X2
    return result
```
## Run stored function
```
func = np.sqrt
X = action.run(
    X1=X1,
    X2=X2,
    func=func,
)
```
# Contributing
We welcome contributions from the community. Please see our contributing guidelines for more information.

# License
This project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details.

# TODO
- [ ] use logging
- [ ] use env var for api key
- [ ] real tests
- [ ] add CI/CD
- [ ] add semantic release
- [ ] add other LLMs

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/torshind/pandas-ai",
    "name": "pandas-chat",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pandas,chatgpt",
    "author": "torshind",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/10/34/9b39b5257e5010feb9450ef800b814725d8dcb739510b31ce769e3f2a1db/pandas-chat-0.0.3.tar.gz",
    "platform": null,
    "description": "# pandas-chat\npandas-chat is a python library that uses LLMs prompts to analyze and process pandas data in a conversational way.\n\n# Installation\nYou can install pandas-chat using pip:\n```\npip install pandas-chat\n```\n\n# LLMs supported\n`api=\"openai\"`\n\n`api=\"hugchat\"`\n# Usage example\n## Creation\n### Input\n```\nimport numpy as np\nimport pandas as pd\nfrom pandas_chat.action import Action\n\naction = Action(\n    api=\"openai\",\n    api_key=\"API_KEY\",\n)\n\nX1 = pd.DataFrame(np.random.rand(10, 3), columns=[\"col1\", \"col2\", \"col3\"])\nX2 = pd.DataFrame(np.random.rand(10, 3), columns=[\"col1\", \"col2\", \"col3\"])\nfunc = np.square\nprompt = \"apply function func to X1 and then subtract X2 from X1\"\n\nX = action.create_and_run(\n    prompt=prompt,\n    X1=X1,\n    X2=X2,\n    func=func,\n)\nprint(action)\n```\n### Output\n```\nReply with a python module using pandas; this module will have one function with arguments X1, X2, func; this function will perform what is described by the following instructions delimited by <<< and >>>; <<<apply function func to X1 and then subtract X2 from X1>>>;\nverify that the reply has all the necessary imports, that it contains only valid python code, and that the keywords used are present in the official documentation of the libraries from which they came;\ndon't include any explanations in your reply, returning only python code.\n\nimport pandas as pd\n\ndef apply_func(X1, X2, func):\n    result = X1.apply(func) - X2\n    return result\n```\n## Run stored function\n```\nfunc = np.sqrt\nX = action.run(\n    X1=X1,\n    X2=X2,\n    func=func,\n)\n```\n# Contributing\nWe welcome contributions from the community. Please see our contributing guidelines for more information.\n\n# License\nThis project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details.\n\n# TODO\n- [ ] use logging\n- [ ] use env var for api key\n- [ ] real tests\n- [ ] add CI/CD\n- [ ] add semantic release\n- [ ] add other LLMs\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "pandas-ai is a python library that uses ChatGPT prompts         to analyze and process pandas data in a conversational way.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/torshind/pandas-ai"
    },
    "split_keywords": [
        "pandas",
        "chatgpt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d179c4cc3c9bc1300a252ef798b0620aaabb42236ac9437d035e2041483302b",
                "md5": "ca79c4ecdfb7ab393bc7c3ba3c2518d1",
                "sha256": "878140191f2dc65b8bbbb249bce5e02553cbf888e0390b0e32e57ded5d7653ee"
            },
            "downloads": -1,
            "filename": "pandas_chat-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ca79c4ecdfb7ab393bc7c3ba3c2518d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4912,
            "upload_time": "2023-05-06T16:57:31",
            "upload_time_iso_8601": "2023-05-06T16:57:31.481969Z",
            "url": "https://files.pythonhosted.org/packages/5d/17/9c4cc3c9bc1300a252ef798b0620aaabb42236ac9437d035e2041483302b/pandas_chat-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10349b39b5257e5010feb9450ef800b814725d8dcb739510b31ce769e3f2a1db",
                "md5": "4ad97dd72854c2dd8bbade28fa41c319",
                "sha256": "f89240abcca79e9b814cd40e0c4301e3fd5932b64b3d4581403360cdcdd84ed3"
            },
            "downloads": -1,
            "filename": "pandas-chat-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4ad97dd72854c2dd8bbade28fa41c319",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5170,
            "upload_time": "2023-05-06T16:57:33",
            "upload_time_iso_8601": "2023-05-06T16:57:33.387796Z",
            "url": "https://files.pythonhosted.org/packages/10/34/9b39b5257e5010feb9450ef800b814725d8dcb739510b31ce769e3f2a1db/pandas-chat-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-06 16:57:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "torshind",
    "github_project": "pandas-ai",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pandas-chat"
}
        
Elapsed time: 0.08115s