@@ -5,4 +5,49 @@ PyMongoArrow
5
5
between MongoDB and Apache Arrow. See
6
6
`GitHub <https://github.com/mongodb-labs/mongo-arrow/tree/main/bindings/python >`_
7
7
for the latest source.
8
+ :Documentation: Available at `mongo-arrow.readthedocs.io <https://mongo-arrow.readthedocs.io/en/latest/ >`_.
8
9
:Author: Prashant Mital
10
+
11
+ **PyMongoArrow ** is a companion library to PyMongo that contains tools
12
+ for loading MongoDB query result sets as Apache Arrow tables, Pandas
13
+ DataFrames or NumPy arrays.
14
+
15
+ .. code-block :: python
16
+
17
+ >> > from pymongoarrow.monkey import patch_all
18
+ >> > patch_all()
19
+ >> > from pymongoarrow.api import Schema
20
+ >> > schema = Schema({' _id' : int , ' qty' : float })
21
+ >> > from pymongo import MongoClient
22
+ >> > client = MongoClient()
23
+ >> > client.db.data.insert_many([{' _id' : 1 , ' qty' : 25.4 }, {' _id' : 2 , ' qty' : 16.9 }, {' _id' : 3 , ' qty' : 2.3 }])
24
+ >> > data_frame = client.db.test.find_pandas_all({}, schema = schema)
25
+ >> > data_frame
26
+ _id qty
27
+ 0 1 25.4
28
+ 1 2 16.9
29
+ 2 3 2.3
30
+ >> > arrow_table = client.db.test.find_arrow_all({}, schema = schema)
31
+ >> > arrow_table
32
+ pyarrow.Table
33
+ _id: int64
34
+ qty: double
35
+ >> > ndarrays = client.db.test.find_numpy_all({}, schema = schema)
36
+ >> > ndarrays
37
+ {' _id' : array([1 , 2 , 3 ]), ' qty' : array([25.4 , 16.9 , 2.3 ])}
38
+
39
+ **PyMongoArrow ** is the recommended way to
40
+ materialize MongoDB query result sets as contiguous-in-memory, typed arrays
41
+ suited for in-memory analytical processing applications.
42
+
43
+ Installing PyMongoArrow
44
+ =======================
45
+ PyMongoArrow is available on PyPI:::
46
+
47
+ $ python -m pip install pymongoarrow
48
+
49
+ PyMongoArrow wheels are available for macOS and Linux on x86_64 architectures.
50
+
51
+ Documentation
52
+ =============
53
+ Full documentation is available on `Read the Docs <https://mongo-arrow.readthedocs.io/en/latest/ >`_.
0 commit comments