MongoDf
A mongoDB to pandas DataFrame converter with a pandas filter style.
Install
pip install mongodf
Filter Example
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()
Metadata
Release files for mongodf 0.1.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mongodf-0.1.16.tar.gz | 15.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mongodf-0.1.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / mongodf-0.1.16.tar.gz
| Download URL | mongodf-0.1.16.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b132de53c65c5cef3e11c795beb20caedd88a14ad3ce94720dc0aa5cb266d499
|
|
BLAKE2b-256 checksum How to use checksums |
7343a00ddf68111a33db270603caf83ba07c51eccf14f6110e6d277160e9bddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / mongodf-0.1.16-py3-none-any.whl
| Download URL | mongodf-0.1.16-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d33383b44ecaf533a042cead218ed577bd18fca6cc3168cc7e4253c078b56d30
|
|
BLAKE2b-256 checksum How to use checksums |
6384053104a2f8c0bee7490a981d2e401dc275ae2a8a6e0365cdd325d581cbf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|