dataframe-handlers


Namedataframe-handlers JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryA package for handling dataframes with optional backends.
upload_time2023-06-26 19:03:17
maintainerJoshua Sundance Bailey
docs_urlNone
authorJoshua Sundance Bailey
requires_python>=3.9
licenseMIT
keywords dataframe interoperability
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This README was produced by [Anthropic's Claude LLM](https://www.anthropic.com/product)

# dataframe_handlers

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![python](https://img.shields.io/badge/Python-3.9+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
![Test coverage](./coverage.svg)


`dataframe_handlers` aims to provide an abstract base class and concrete implementations for handling and manipulating dataframes of various types in Python.
While the interface may be applicable to many use cases, the immediate goal is to standardize interaction with dataframe libraries and enable interoperability between them in the context of the [Solara](https://solara.dev) Python library, which can be used to create reactive web apps using pure Python.


## Installation

https://pypi.org/project/dataframe-handlers

```bash
# any of the following

pip install dataframe-handlers
pip install dataframe-handlers[pandas]
pip install dataframe-handlers[dask]
pip install dataframe-handlers[xarray]
# pip install dataframe-handlers[vaex]
pip install dataframe-handlers[testing]

pip install dataframe-handlers[pandas,xarray,testing]
```

## Usage

The base class, `BaseDataFrameHandler`, defines an abstract interface with the following methods:

- `get_unique(column: str, limit: Optional[int] = None) -> Collection`
- `get_value_counts(column: str, limit: Optional[int] = None) -> Mapping[str, int]`
- `get_data_range(column: str) -> Sequence`
- `get_missing_filter(column: str) -> Sequence[bool]`
- `get_value_filter(column: str, values: list, invert: bool = False) -> Sequence[bool]`
- `get_columns() -> Collection[str]`
- `get_numeric_columns() -> Collection[str]`
- `get_column_types(default_str: bool = True) -> Mapping[str, Union[object, type, str]]`

Concrete implementations of this interface exist for:

- Pandas (`PandasDataFrameHandler`)
- Dask (`DaskDataFrameHandler`)
- Xarray (`XarrayDataFrameHandler`)
- Vaex (`VaexDataFrameHandler`, *currently disabled*)

The easiest way to get a handler does not require knowing what type of dataframe you're dealing with.

You can do this by using `dataframe_handlers.get_handler`, which will return a handler of the appropriate type based on the type of dataframe it is given.

```python
import pandas as pd
from dataframe_handlers import get_handler

df = pd.DataFrame({'A': [1, 2, 3]})
handler = get_handler(df)

columns = handler.get_columns()
# ['A']
```

Libraries built on the `dataframe_handlers` interface can then support multiple dataframe types interchangeably.

## Contributing

There are a few ways you can contribute to `dataframe_handlers` and help guide its future:

1. Add support for another dataframe library by implementing a new concrete handler class. This helps expand the scope of the project and allows it to support new use cases.

2. Improve or expand the abstract base interface. As new methods are identified to broadly support dataframe interaction and manipulation, the interface can be expanded. However, we aim to keep the interface as concise as possible to facilitate implementation for many types. **User feedback on what methods/functionality would be most useful to support is appreciated!**

3. Improve existing concrete implementations. More comprehensive testing, performance optimizations and support for newer library versions all help improve the quality of the project.

4. Improve documentation. Additional details on implementing new handlers, more examples, and type hints help make the project more contributor-friendly.

5. Improve validation. Stricter checks that subclasses implement the required methods, consistent method signatures, and edge case testing all help users build on the interface.

**We aim for `dataframe_handlers` to be a community project guided by user needs and feedback.** Please feel free to open issues or start a discussion to propose new ideas, give feedback on the direction of the project or interface design, or submit pull requests with your contributions and improvements!

For specific instructions, please see `CONTRIBUTING.md`.


## License

`dataframe_handlers` is licensed under the MIT license. See the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dataframe-handlers",
    "maintainer": "Joshua Sundance Bailey",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "dataframe,interoperability",
    "author": "Joshua Sundance Bailey",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/71/18/99d74442c25e6e1ceec672ce5925dcfa567bd3a2fc0a3eeb5b3c119db234/dataframe_handlers-0.0.5.tar.gz",
    "platform": null,
    "description": "This README was produced by [Anthropic's Claude LLM](https://www.anthropic.com/product)\n\n# dataframe_handlers\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![python](https://img.shields.io/badge/Python-3.9+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n![Test coverage](./coverage.svg)\n\n\n`dataframe_handlers` aims to provide an abstract base class and concrete implementations for handling and manipulating dataframes of various types in Python.\nWhile the interface may be applicable to many use cases, the immediate goal is to standardize interaction with dataframe libraries and enable interoperability between them in the context of the [Solara](https://solara.dev) Python library, which can be used to create reactive web apps using pure Python.\n\n\n## Installation\n\nhttps://pypi.org/project/dataframe-handlers\n\n```bash\n# any of the following\n\npip install dataframe-handlers\npip install dataframe-handlers[pandas]\npip install dataframe-handlers[dask]\npip install dataframe-handlers[xarray]\n# pip install dataframe-handlers[vaex]\npip install dataframe-handlers[testing]\n\npip install dataframe-handlers[pandas,xarray,testing]\n```\n\n## Usage\n\nThe base class, `BaseDataFrameHandler`, defines an abstract interface with the following methods:\n\n- `get_unique(column: str, limit: Optional[int] = None) -> Collection`\n- `get_value_counts(column: str, limit: Optional[int] = None) -> Mapping[str, int]`\n- `get_data_range(column: str) -> Sequence`\n- `get_missing_filter(column: str) -> Sequence[bool]`\n- `get_value_filter(column: str, values: list, invert: bool = False) -> Sequence[bool]`\n- `get_columns() -> Collection[str]`\n- `get_numeric_columns() -> Collection[str]`\n- `get_column_types(default_str: bool = True) -> Mapping[str, Union[object, type, str]]`\n\nConcrete implementations of this interface exist for:\n\n- Pandas (`PandasDataFrameHandler`)\n- Dask (`DaskDataFrameHandler`)\n- Xarray (`XarrayDataFrameHandler`)\n- Vaex (`VaexDataFrameHandler`, *currently disabled*)\n\nThe easiest way to get a handler does not require knowing what type of dataframe you're dealing with.\n\nYou can do this by using `dataframe_handlers.get_handler`, which will return a handler of the appropriate type based on the type of dataframe it is given.\n\n```python\nimport pandas as pd\nfrom dataframe_handlers import get_handler\n\ndf = pd.DataFrame({'A': [1, 2, 3]})\nhandler = get_handler(df)\n\ncolumns = handler.get_columns()\n# ['A']\n```\n\nLibraries built on the `dataframe_handlers` interface can then support multiple dataframe types interchangeably.\n\n## Contributing\n\nThere are a few ways you can contribute to `dataframe_handlers` and help guide its future:\n\n1. Add support for another dataframe library by implementing a new concrete handler class. This helps expand the scope of the project and allows it to support new use cases.\n\n2. Improve or expand the abstract base interface. As new methods are identified to broadly support dataframe interaction and manipulation, the interface can be expanded. However, we aim to keep the interface as concise as possible to facilitate implementation for many types. **User feedback on what methods/functionality would be most useful to support is appreciated!**\n\n3. Improve existing concrete implementations. More comprehensive testing, performance optimizations and support for newer library versions all help improve the quality of the project.\n\n4. Improve documentation. Additional details on implementing new handlers, more examples, and type hints help make the project more contributor-friendly.\n\n5. Improve validation. Stricter checks that subclasses implement the required methods, consistent method signatures, and edge case testing all help users build on the interface.\n\n**We aim for `dataframe_handlers` to be a community project guided by user needs and feedback.** Please feel free to open issues or start a discussion to propose new ideas, give feedback on the direction of the project or interface design, or submit pull requests with your contributions and improvements!\n\nFor specific instructions, please see `CONTRIBUTING.md`.\n\n\n## License\n\n`dataframe_handlers` is licensed under the MIT license. See the LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package for handling dataframes with optional backends.",
    "version": "0.0.5",
    "project_urls": {
        "Repository": "https://github.com/joshuasundance-swca/dataframe_handlers.git"
    },
    "split_keywords": [
        "dataframe",
        "interoperability"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a7b9ed71bd90083115d85b71eeb7d6712a2f60ccf76e45e205cf75375236752",
                "md5": "9b1ab1c249531a0d61938a12e7809562",
                "sha256": "af5d1d635d063380e89dc3acb0cd21f7acd403f2a746224023db77db8fdcde42"
            },
            "downloads": -1,
            "filename": "dataframe_handlers-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b1ab1c249531a0d61938a12e7809562",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10981,
            "upload_time": "2023-06-26T19:03:13",
            "upload_time_iso_8601": "2023-06-26T19:03:13.736225Z",
            "url": "https://files.pythonhosted.org/packages/7a/7b/9ed71bd90083115d85b71eeb7d6712a2f60ccf76e45e205cf75375236752/dataframe_handlers-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "711899d74442c25e6e1ceec672ce5925dcfa567bd3a2fc0a3eeb5b3c119db234",
                "md5": "e066f138cd060ab4856056ac8692fb25",
                "sha256": "dae43c4467e313294c7de86ddc786b1c408512110f1cc6e7bcba8cbaefac6e6c"
            },
            "downloads": -1,
            "filename": "dataframe_handlers-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e066f138cd060ab4856056ac8692fb25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 16088,
            "upload_time": "2023-06-26T19:03:17",
            "upload_time_iso_8601": "2023-06-26T19:03:17.857428Z",
            "url": "https://files.pythonhosted.org/packages/71/18/99d74442c25e6e1ceec672ce5925dcfa567bd3a2fc0a3eeb5b3c119db234/dataframe_handlers-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-26 19:03:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshuasundance-swca",
    "github_project": "dataframe_handlers",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "dataframe-handlers"
}
        
Elapsed time: 0.08801s