dataframes-haystack


Namedataframes-haystack JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryHaystack custom components for your favourite dataframe library.
upload_time2024-04-06 17:53:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024-present Edoardo Abati <29585319+EdAbati@users.noreply.github.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ai dataframe haystack llm machine-learning nlp pandas polars
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dataframes Haystack

[![PyPI - Version](https://img.shields.io/pypi/v/dataframes-haystack.svg)](https://pypi.org/project/dataframes-haystack)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dataframes-haystack?logo=python&logoColor=white)](https://pypi.org/project/dataframes-haystack)
[![PyPI - License](https://img.shields.io/pypi/l/dataframes-haystack.svg)](https://pypi.org/project/dataframes-haystack)


[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/EdAbati/dataframes-haystack/main.svg)](https://results.pre-commit.ci/latest/github/EdAbati/dataframes-haystack/main)

-----

## 📃 Description

`dataframes-haystack` is an extension for [Haystack 2](https://docs.haystack.deepset.ai/docs/intro) that enables integration with dataframe libraries.

The library offers custom [Converters](https://docs.haystack.deepset.ai/docs/converters) components that convert data stored in dataframes into Haystack [`Document`](https://docs.haystack.deepset.ai/docs/data-classes#document) objects.

The dataframe libraries currently supported are:
- [pandas](https://pandas.pydata.org/)
- [Polars](https://pola.rs)

## 🛠️ Installation

```sh
# for pandas (pandas is already included in `haystack-ai`)
pip install dataframes-haystack

# for polars
pip install "dataframes-haystack[polars]"
```

## 💻 Usage

> [!TIP]
> See the [Example Notebooks](./notebooks) for complete examples.

### Pandas

```python
import pandas as pd

from dataframes_haystack.components.converters.pandas import PandasDataFrameConverter

df = pd.DataFrame({
    "text": ["Hello world", "Hello everyone"],
    "filename": ["doc1.txt", "doc2.txt"],
})

converter = PandasDataFrameConverter(content_column="text", meta_columns=["filename"])
documents = converter.run(df)
```

Result:
```python
>>> documents
{'documents': [
    Document(id=0, content: 'Hello world', meta: {'filename': 'doc1.txt'}),
    Document(id=1, content: 'Hello everyone', meta: {'filename': 'doc2.txt'})
]}
```

### Polars

```python
import polars as pl

from dataframes_haystack.components.converters.polars import PolarsDataFrameConverter

df = pl.DataFrame({
    "text": ["Hello world", "Hello everyone"],
    "filename": ["doc1.txt", "doc2.txt"],
})

converter = PolarsDataFrameConverter(content_column="text", meta_columns=["filename"])
documents = converter.run(df)
```

Result:
```python
>>> documents
{'documents': [
    Document(id=0, content: 'Hello world', meta: {'filename': 'doc1.txt'}),
    Document(id=1, content: 'Hello everyone', meta: {'filename': 'doc2.txt'})
]}
```

## 🤝 Contributing

Do you have an idea for a new feature? Did you find a bug that needs fixing?

Feel free to [open an issue](https://github.com/EdAbati/dataframes-haystack/issues) or submit a PR!

### Setup development environment

Requirements: [`hatch`](https://hatch.pypa.io/latest/install/), [`pre-commit`](https://pre-commit.com/#install)

1. Clone the repository
1. Run `hatch shell` to create and activate a virtual environment
1. Run `pre-commit install` to install the pre-commit hooks. This will force the linting and formatting checks.

### Run tests

- Linting and formatting checks: `hatch run lint:fmt`
- Unit tests: `hatch run test-cov-all`

## ✍️ License

`dataframes-haystack` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dataframes-haystack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, dataframe, haystack, llm, machine-learning, nlp, pandas, polars",
    "author": null,
    "author_email": "Edoardo Abati <29585319+EdAbati@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/85/cd/8da539f21de731e6b625d48825ee2022fb29cf6c4123618ec4268f224ef4/dataframes_haystack-0.0.1.tar.gz",
    "platform": null,
    "description": "# Dataframes Haystack\n\n[![PyPI - Version](https://img.shields.io/pypi/v/dataframes-haystack.svg)](https://pypi.org/project/dataframes-haystack)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dataframes-haystack?logo=python&logoColor=white)](https://pypi.org/project/dataframes-haystack)\n[![PyPI - License](https://img.shields.io/pypi/l/dataframes-haystack.svg)](https://pypi.org/project/dataframes-haystack)\n\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/EdAbati/dataframes-haystack/main.svg)](https://results.pre-commit.ci/latest/github/EdAbati/dataframes-haystack/main)\n\n-----\n\n## \ud83d\udcc3 Description\n\n`dataframes-haystack` is an extension for [Haystack 2](https://docs.haystack.deepset.ai/docs/intro) that enables integration with dataframe libraries.\n\nThe library offers custom [Converters](https://docs.haystack.deepset.ai/docs/converters) components that convert data stored in dataframes into Haystack [`Document`](https://docs.haystack.deepset.ai/docs/data-classes#document) objects.\n\nThe dataframe libraries currently supported are:\n- [pandas](https://pandas.pydata.org/)\n- [Polars](https://pola.rs)\n\n## \ud83d\udee0\ufe0f Installation\n\n```sh\n# for pandas (pandas is already included in `haystack-ai`)\npip install dataframes-haystack\n\n# for polars\npip install \"dataframes-haystack[polars]\"\n```\n\n## \ud83d\udcbb Usage\n\n> [!TIP]\n> See the [Example Notebooks](./notebooks) for complete examples.\n\n### Pandas\n\n```python\nimport pandas as pd\n\nfrom dataframes_haystack.components.converters.pandas import PandasDataFrameConverter\n\ndf = pd.DataFrame({\n    \"text\": [\"Hello world\", \"Hello everyone\"],\n    \"filename\": [\"doc1.txt\", \"doc2.txt\"],\n})\n\nconverter = PandasDataFrameConverter(content_column=\"text\", meta_columns=[\"filename\"])\ndocuments = converter.run(df)\n```\n\nResult:\n```python\n>>> documents\n{'documents': [\n    Document(id=0, content: 'Hello world', meta: {'filename': 'doc1.txt'}),\n    Document(id=1, content: 'Hello everyone', meta: {'filename': 'doc2.txt'})\n]}\n```\n\n### Polars\n\n```python\nimport polars as pl\n\nfrom dataframes_haystack.components.converters.polars import PolarsDataFrameConverter\n\ndf = pl.DataFrame({\n    \"text\": [\"Hello world\", \"Hello everyone\"],\n    \"filename\": [\"doc1.txt\", \"doc2.txt\"],\n})\n\nconverter = PolarsDataFrameConverter(content_column=\"text\", meta_columns=[\"filename\"])\ndocuments = converter.run(df)\n```\n\nResult:\n```python\n>>> documents\n{'documents': [\n    Document(id=0, content: 'Hello world', meta: {'filename': 'doc1.txt'}),\n    Document(id=1, content: 'Hello everyone', meta: {'filename': 'doc2.txt'})\n]}\n```\n\n## \ud83e\udd1d Contributing\n\nDo you have an idea for a new feature? Did you find a bug that needs fixing?\n\nFeel free to [open an issue](https://github.com/EdAbati/dataframes-haystack/issues) or submit a PR!\n\n### Setup development environment\n\nRequirements: [`hatch`](https://hatch.pypa.io/latest/install/), [`pre-commit`](https://pre-commit.com/#install)\n\n1. Clone the repository\n1. Run `hatch shell` to create and activate a virtual environment\n1. Run `pre-commit install` to install the pre-commit hooks. This will force the linting and formatting checks.\n\n### Run tests\n\n- Linting and formatting checks: `hatch run lint:fmt`\n- Unit tests: `hatch run test-cov-all`\n\n## \u270d\ufe0f License\n\n`dataframes-haystack` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024-present Edoardo Abati <29585319+EdAbati@users.noreply.github.com>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Haystack custom components for your favourite dataframe library.",
    "version": "0.0.1",
    "project_urls": {
        "Documentation": "https://github.com/EdAbati/dataframes-haystack#readme",
        "Issues": "https://github.com/EdAbati/dataframes-haystack/issues",
        "Source": "https://github.com/EdAbati/dataframes-haystack"
    },
    "split_keywords": [
        "ai",
        " dataframe",
        " haystack",
        " llm",
        " machine-learning",
        " nlp",
        " pandas",
        " polars"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "410b971178054da529af451fc960407d324fe913646fc4f325e51393be0dae95",
                "md5": "965b9bc2524f382c587a02ba2072cfa7",
                "sha256": "e74a0ea7d0db92e625f2ce35859d3acf9c0d061c3a4fc75e785e8d017599ee44"
            },
            "downloads": -1,
            "filename": "dataframes_haystack-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "965b9bc2524f382c587a02ba2072cfa7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7891,
            "upload_time": "2024-04-06T17:53:52",
            "upload_time_iso_8601": "2024-04-06T17:53:52.533681Z",
            "url": "https://files.pythonhosted.org/packages/41/0b/971178054da529af451fc960407d324fe913646fc4f325e51393be0dae95/dataframes_haystack-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85cd8da539f21de731e6b625d48825ee2022fb29cf6c4123618ec4268f224ef4",
                "md5": "daaed7fdf702f3d6b443ffe7093ea62e",
                "sha256": "4741c3d6337a76429b4415a316cb6e7f0e61deb309cb902c2a020e7b3c62b2db"
            },
            "downloads": -1,
            "filename": "dataframes_haystack-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "daaed7fdf702f3d6b443ffe7093ea62e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 93755,
            "upload_time": "2024-04-06T17:53:53",
            "upload_time_iso_8601": "2024-04-06T17:53:53.745123Z",
            "url": "https://files.pythonhosted.org/packages/85/cd/8da539f21de731e6b625d48825ee2022fb29cf6c4123618ec4268f224ef4/dataframes_haystack-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-06 17:53:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EdAbati",
    "github_project": "dataframes-haystack#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dataframes-haystack"
}
        
Elapsed time: 0.20987s