Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Tools for using NumPy, Pandas and PyArrow with MongoDB

Project description

Info:A companion library to PyMongo that makes it easy to move data between MongoDB and Apache Arrow. See GitHub for the latest source.
Documentation:Available at mongo-arrow.readthedocs.io.
Author: Prashant Mital

PyMongoArrow is a companion library to PyMongo that contains tools for loading MongoDB query result sets as Apache Arrow tables, Pandas DataFrames or NumPy arrays.

>>> from pymongoarrow.monkey import patch_all
>>> patch_all()
>>> from pymongoarrow.api import Schema
>>> schema = Schema({'_id': int, 'qty': float})
>>> from pymongo import MongoClient
>>> client = MongoClient()
>>> client.db.data.insert_many([{'_id': 1, 'qty': 25.4}, {'_id': 2, 'qty': 16.9}, {'_id': 3, 'qty': 2.3}])
>>> data_frame = client.db.test.find_pandas_all({}, schema=schema)
>>> data_frame
   _id   qty
0    1  25.4
1    2  16.9
2    3   2.3
>>> arrow_table = client.db.test.find_arrow_all({}, schema=schema)
>>> arrow_table
pyarrow.Table
_id: int64
qty: double
>>> ndarrays = client.db.test.find_numpy_all({}, schema=schema)
>>> ndarrays
{'_id': array([1, 2, 3]), 'qty': array([25.4, 16.9,  2.3])}

PyMongoArrow is the recommended way to materialize MongoDB query result sets as contiguous-in-memory, typed arrays suited for in-memory analytical processing applications.

Installing PyMongoArrow

PyMongoArrow is available on PyPI::

$ python -m pip install pymongoarrow

PyMongoArrow wheels are available for macOS and Linux on x86_64 architectures.

Documentation

Full documentation is available on Read the Docs.

Project details


Download files

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

Files for pymongoarrow, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pymongoarrow-0.1.1-cp36-cp36m-macosx_10_14_x86_64.whl (188.5 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp36-cp36m-manylinux2010_x86_64.whl (837.7 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp36-cp36m-manylinux2014_x86_64.whl (891.8 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp37-cp37m-macosx_10_14_x86_64.whl (186.8 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp37-cp37m-manylinux2010_x86_64.whl (837.6 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp37-cp37m-manylinux2014_x86_64.whl (890.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp38-cp38-macosx_10_14_x86_64.whl (187.7 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp38-cp38-manylinux2010_x86_64.whl (863.8 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp38-cp38-manylinux2014_x86_64.whl (897.1 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp39-cp39-macosx_10_14_x86_64.whl (188.3 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp39-cp39-manylinux2010_x86_64.whl (851.6 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymongoarrow-0.1.1-cp39-cp39-manylinux2014_x86_64.whl (888.3 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymongoarrow-0.1.1.tar.gz (16.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page