Skip to content

Commit

Permalink
Docs page for py2neo.export
Browse files Browse the repository at this point in the history
  • Loading branch information
technige committed May 4, 2021
1 parent 0bb2213 commit a60b0c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
8 changes: 8 additions & 0 deletions docs/bulk/export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
***********************************

.. automodule:: py2neo.export

.. autofunction:: to_numpy_ndarray

.. autofunction:: to_pandas_series

.. autofunction:: to_pandas_data_frame

.. autofunction:: to_sympy_matrix
30 changes: 18 additions & 12 deletions py2neo/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,26 @@
# limitations under the License.


from __future__ import absolute_import, print_function, unicode_literals
"""
This module allows exporting data to external formats.
Example:
>>> from py2neo import Graph
>>> from py2neo.export import to_pandas_data_frame
>>> graph = Graph()
>>> to_pandas_data_frame(graph.run("MATCH (a:Person) RETURN a.name, a.born LIMIT 4"))
a.born a.name
0 1964 Keanu Reeves
1 1967 Carrie-Anne Moss
2 1961 Laurence Fishburne
3 1960 Hugo Weaving
"""


from __future__ import absolute_import, print_function, unicode_literals

from io import StringIO
from warnings import warn

Expand Down Expand Up @@ -79,17 +96,6 @@ def to_pandas_data_frame(cursor, index=None, columns=None, dtype=None):
""" Consume and extract the entire result as a
`pandas.DataFrame <http://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe>`_.
::
>>> from py2neo import Graph
>>> graph = Graph()
>>> graph.run("MATCH (a:Person) RETURN a.name, a.born LIMIT 4").to_data_frame()
a.born a.name
0 1964 Keanu Reeves
1 1967 Carrie-Anne Moss
2 1961 Laurence Fishburne
3 1960 Hugo Weaving
.. note::
This method requires `pandas` to be installed.
Expand Down

0 comments on commit a60b0c4

Please sign in to comment.