From a60b0c461f95f7290d532f2c4e7ca32af86f27f9 Mon Sep 17 00:00:00 2001 From: Nigel Small Date: Tue, 4 May 2021 17:47:08 +0100 Subject: [PATCH] Docs page for py2neo.export --- docs/bulk/export.rst | 8 ++++++++ py2neo/export.py | 30 ++++++++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/bulk/export.rst b/docs/bulk/export.rst index 9a1ab36d..726c8583 100644 --- a/docs/bulk/export.rst +++ b/docs/bulk/export.rst @@ -3,3 +3,11 @@ *********************************** .. automodule:: py2neo.export + +.. autofunction:: to_numpy_ndarray + +.. autofunction:: to_pandas_series + +.. autofunction:: to_pandas_data_frame + +.. autofunction:: to_sympy_matrix diff --git a/py2neo/export.py b/py2neo/export.py index febce7ee..0def54ea 100644 --- a/py2neo/export.py +++ b/py2neo/export.py @@ -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 @@ -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 `_. - :: - - >>> 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.