py2neo.export
– Exporting data¶
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
-
py2neo.export.
to_numpy_ndarray
(cursor, dtype=None, order='K')[source]¶ Consume and extract the entire result as a numpy.ndarray.
Note
This method requires numpy to be installed.
- Parameters
cursor –
dtype –
order –
- Warns
If numpy is not installed
- Returns
ndarray object.
-
py2neo.export.
to_pandas_series
(cursor, field=0, index=None, dtype=None)[source]¶ Consume and extract one field of the entire result as a pandas.Series.
Note
This method requires pandas to be installed.
- Parameters
cursor –
field –
index –
dtype –
- Warns
If pandas is not installed
- Returns
Series object.
-
py2neo.export.
to_pandas_data_frame
(cursor, index=None, columns=None, dtype=None)[source]¶ Consume and extract the entire result as a pandas.DataFrame.
Note
This method requires pandas to be installed.
- Parameters
cursor –
index – Index to use for resulting frame.
columns – Column labels to use for resulting frame.
dtype – Data type to force.
- Warns
If pandas is not installed
- Returns
DataFrame object.
-
py2neo.export.
to_sympy_matrix
(cursor, mutable=False)[source]¶ Consume and extract the entire result as a sympy.Matrix.
Note
This method requires sympy to be installed.
- Parameters
cursor –
mutable –
- Returns
Matrix object.