Skip to main content

No project description provided

Project description

MongoDf

Python Package PyPI Documentation

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongodf-0.1.16.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

mongodf-0.1.16-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file mongodf-0.1.16.tar.gz.

File metadata

  • Download URL: mongodf-0.1.16.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for mongodf-0.1.16.tar.gz
Algorithm Hash digest
SHA256 b132de53c65c5cef3e11c795beb20caedd88a14ad3ce94720dc0aa5cb266d499
MD5 21d3b0d149d48348d100b56968f4aef8
BLAKE2b-256 7343a00ddf68111a33db270603caf83ba07c51eccf14f6110e6d277160e9bddc

See more details on using hashes here.

File details

Details for the file mongodf-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: mongodf-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for mongodf-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 d33383b44ecaf533a042cead218ed577bd18fca6cc3168cc7e4253c078b56d30
MD5 9286e825bc25ca13e387e1b1f73ea3be
BLAKE2b-256 6384053104a2f8c0bee7490a981d2e401dc275ae2a8a6e0365cdd325d581cbf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page