mongodf


Namemongodf JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://github.com/VK/mongodf
SummaryNone
upload_time2024-09-16 14:28:58
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords mongodb pandas dataframe filter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MongoDf

[![Python Package](https://github.com/VK/mongodf/actions/workflows/python-publish.yml/badge.svg)](https://github.com/VK/mongodf/actions/workflows/python-publish.yml)
[![PyPI](https://img.shields.io/pypi/v/mongodf?logo=pypi)](https://pypi.org/project/mongodf)
[![Documentation](https://github.com/VK/mongodf/workflows/Documentation/badge.svg)](https://vk.github.io/mongodf)


A mongoDB to pandas DataFrame converter with a pandas filter style.

## Install
```
pip install mongodf
```

## Filter Example
```python
import mongodf
import pymongo

mongo = pymongo.MongoClient("mongodb://mongo:27017")

# create a dataframe from a mongoDB collection
df = mongodf.from_mongo(mongo, "DB", "Collection")

# filter values
df = df[(df["colA"] == "Test") & (df.ColB.isin([1, 2]))]

# filter columns
df = df[["colA", "colC"]]

# compute a pandas.DataFrame
df.compute()
```

|   | colA  | colC |
|---| ----- | ---- |
|0  | Test  |  NaN |
|1  | Test  |   12 |



## Cache Example
```
import plotly.express as px
df = px.data.gapminder()

cache = MongoDFCache(
    host="mongodb://mongo:27017",
    database="mongodfcache",
    expire_after_seconds=20,
)

# put the dataframe into the mongo cache
# the name can be auto generated, array_group can be a list of cols
id = cache.cache_dataframe(df, "test_df", array_group=True)

# get a mongodf without reading all the data
cdf = cache.get_dataframe(id)

# get the metadata and the content of the dataframe
gcdf.get_meta()
gcdf.compute()

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/VK/mongodf",
    "name": "mongodf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "mongoDB pandas dataframe filter",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c6/04/6fe1b5b2d5c70f3ccc9fa9b628fc6f6e6fb7361f32aceff63e67174fc257/mongodf-0.1.10.tar.gz",
    "platform": null,
    "description": "# MongoDf\n\n[![Python Package](https://github.com/VK/mongodf/actions/workflows/python-publish.yml/badge.svg)](https://github.com/VK/mongodf/actions/workflows/python-publish.yml)\n[![PyPI](https://img.shields.io/pypi/v/mongodf?logo=pypi)](https://pypi.org/project/mongodf)\n[![Documentation](https://github.com/VK/mongodf/workflows/Documentation/badge.svg)](https://vk.github.io/mongodf)\n\n\nA mongoDB to pandas DataFrame converter with a pandas filter style.\n\n## Install\n```\npip install mongodf\n```\n\n## Filter Example\n```python\nimport mongodf\nimport pymongo\n\nmongo = pymongo.MongoClient(\"mongodb://mongo:27017\")\n\n# create a dataframe from a mongoDB collection\ndf = mongodf.from_mongo(mongo, \"DB\", \"Collection\")\n\n# filter values\ndf = df[(df[\"colA\"] == \"Test\") & (df.ColB.isin([1, 2]))]\n\n# filter columns\ndf = df[[\"colA\", \"colC\"]]\n\n# compute a pandas.DataFrame\ndf.compute()\n```\n\n|   | colA  | colC |\n|---| ----- | ---- |\n|0  | Test  |  NaN |\n|1  | Test  |   12 |\n\n\n\n## Cache Example\n```\nimport plotly.express as px\ndf = px.data.gapminder()\n\ncache = MongoDFCache(\n    host=\"mongodb://mongo:27017\",\n    database=\"mongodfcache\",\n    expire_after_seconds=20,\n)\n\n# put the dataframe into the mongo cache\n# the name can be auto generated, array_group can be a list of cols\nid = cache.cache_dataframe(df, \"test_df\", array_group=True)\n\n# get a mongodf without reading all the data\ncdf = cache.get_dataframe(id)\n\n# get the metadata and the content of the dataframe\ngcdf.get_meta()\ngcdf.compute()\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "0.1.10",
    "project_urls": {
        "Homepage": "https://github.com/VK/mongodf"
    },
    "split_keywords": [
        "mongodb",
        "pandas",
        "dataframe",
        "filter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e5e2867f586eaf3bdf85345bc4f1be25bf508a38bc6ed4779e6c38036bcf4a92",
                "md5": "937c0df69aa4267aa1d90fb0d3874e04",
                "sha256": "ca331ae7b2e43a0fdb8317fbe29d54bcb4ebe9ae864400bed8c971c7af0aef9e"
            },
            "downloads": -1,
            "filename": "mongodf-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "937c0df69aa4267aa1d90fb0d3874e04",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17558,
            "upload_time": "2024-09-16T14:28:56",
            "upload_time_iso_8601": "2024-09-16T14:28:56.300465Z",
            "url": "https://files.pythonhosted.org/packages/e5/e2/867f586eaf3bdf85345bc4f1be25bf508a38bc6ed4779e6c38036bcf4a92/mongodf-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6046fe1b5b2d5c70f3ccc9fa9b628fc6f6e6fb7361f32aceff63e67174fc257",
                "md5": "f81b64f7485453fe92bba9ab1412e415",
                "sha256": "695562ee206487b6b7475a27a7269255cc7655558fa0724e315a1bc0540a594b"
            },
            "downloads": -1,
            "filename": "mongodf-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f81b64f7485453fe92bba9ab1412e415",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14038,
            "upload_time": "2024-09-16T14:28:58",
            "upload_time_iso_8601": "2024-09-16T14:28:58.170254Z",
            "url": "https://files.pythonhosted.org/packages/c6/04/6fe1b5b2d5c70f3ccc9fa9b628fc6f6e6fb7361f32aceff63e67174fc257/mongodf-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-16 14:28:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VK",
    "github_project": "mongodf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mongodf"
}
        
Elapsed time: 0.54521s