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.10.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

mongodf-0.1.10-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mongodf-0.1.10.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for mongodf-0.1.10.tar.gz
Algorithm Hash digest
SHA256 695562ee206487b6b7475a27a7269255cc7655558fa0724e315a1bc0540a594b
MD5 f81b64f7485453fe92bba9ab1412e415
BLAKE2b-256 c6046fe1b5b2d5c70f3ccc9fa9b628fc6f6e6fb7361f32aceff63e67174fc257

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mongodf-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for mongodf-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ca331ae7b2e43a0fdb8317fbe29d54bcb4ebe9ae864400bed8c971c7af0aef9e
MD5 937c0df69aa4267aa1d90fb0d3874e04
BLAKE2b-256 e5e2867f586eaf3bdf85345bc4f1be25bf508a38bc6ed4779e6c38036bcf4a92

See more details on using hashes here.

Supported by

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