Skip to content

Commit f2bf0f9

Browse files
authored
ARROW-92 Create documentation for writing tabular data (#78)
1 parent ca88c6e commit f2bf0f9

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

bindings/python/docs/environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ dependencies:
66
- sphinx
77
- libbson
88
- pkg-config
9+
- pandas
10+
- numpy

bindings/python/docs/source/developer/installation.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ PyMongoArrow uses `libbson <http://mongoc.org/libbson/current/index.html>`_.
3737
Detailed instructions for building/installing ``libbson`` can be found
3838
`here <http://mongoc.org/libmongoc/1.21.0/installing.html#installing-the-mongodb-c-driver-libmongoc-and-bson-library-libbson>`_.
3939

40+
4041
You can either use a system-provided version of ``libbson`` that is properly
41-
configured for use with ``pkg-config``, or use the provided ``build-libbson.sh` ` script to build it::
42+
configured for use with ``pkg-config``, or use the provided ``build-libbson.sh`` script to build it::
4243

4344
$ LIBBSON_INSTALL_DIR=$(pwd)/libbson ./build-libbson.sh
4445

bindings/python/docs/source/quickstart.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,17 @@ of formats including CSV, and HDF. For example, to write the data frame
117117
referenced by the variable ``df`` to a CSV file ``out.csv``, run::
118118

119119
df.to_csv('out.csv', index=False)
120+
121+
122+
Writing back to MongoDB
123+
-----------------------
124+
Result sets that have been loaded as Arrow's :class:`~pyarrow.Table` type, Pandas'
125+
:class:`~pandas.DataFrame` type, or NumPy's :class:`~numpy.ndarray` type can
126+
be easily written to your MongoDB database using the :meth:`~pymongoarrow.api.write` function::
127+
128+
from pymongoarrow.api import write
129+
from pymongo import MongoClient
130+
coll = MongoClient().db.my_collection
131+
write(coll, df)
132+
write(coll, arrow_table)
133+
write(coll, ndarrays)

0 commit comments

Comments
 (0)