Minor updates to docs and doctests

This commit is contained in:
Stephen Dodson 2019-11-22 16:22:16 +00:00
parent 84e23ab5d1
commit 91c811345c
8 changed files with 88 additions and 6 deletions

View File

@ -0,0 +1,6 @@
eland.DataFrame.to_numpy
========================
.. currentmodule:: eland
.. automethod:: DataFrame.to_numpy

View File

@ -0,0 +1,6 @@
eland.DataFrame.values
======================
.. currentmodule:: eland
.. autoattribute:: DataFrame.values

View File

@ -0,0 +1,6 @@
eland.Series.info_es
====================
.. currentmodule:: eland
.. automethod:: Series.info_es

View File

@ -0,0 +1,6 @@
eland.Series.to_numpy
=====================
.. currentmodule:: eland
.. automethod:: Series.to_numpy

View File

@ -23,6 +23,7 @@ Attributes and underlying data
DataFrame.columns
DataFrame.dtypes
DataFrame.select_dtypes
DataFrame.values
DataFrame.empty
DataFrame.shape
@ -81,6 +82,7 @@ Serialization / IO / conversion
:toctree: api/
DataFrame.info
DataFrame.to_numpy
DataFrame.to_csv
DataFrame.to_html
DataFrame.to_string

View File

@ -72,6 +72,7 @@ Serialization / IO / conversion
:toctree: api/
Series.to_string
Series.to_numpy
Elasticsearch utilities
~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1064,12 +1064,31 @@ class DataFrame(NDFrame):
In pandas this returns a Numpy representation of the DataFrame. This would involve scan/scrolling the
entire index.
If this is required, call ``ed.eland_to_pandas(ed_df).values``, _but beware this will scan/scroll the entire
Elasticsearch index(s) into memory_
If this is required, call ``ed.eland_to_pandas(ed_df).values``, *but beware this will scan/scroll the entire
Elasticsearch index(s) into memory.*
See Also
--------
:pandas_api_docs:`pandas.DataFrame.values`
eland_to_pandas
to_numpy
"""
self.to_numpy()
def to_numpy(self):
"""
Not implemented.
In pandas this returns a Numpy representation of the DataFrame. This would involve scan/scrolling the
entire index.
If this is required, call ``ed.eland_to_pandas(ed_df).values``, *but beware this will scan/scroll the entire
Elasticsearch index(s) into memory.*
See Also
--------
:pandas_api_docs:`pandas.DataFrame.to_numpy`
eland_to_pandas
Examples
--------
@ -1094,9 +1113,8 @@ class DataFrame(NDFrame):
[181.69421554118, 'Kibana Airlines'],
[730.041778346198, 'Kibana Airlines']], dtype=object)
"""
raise NotImplementedError(
raise AttributeError(
"This method would scan/scroll the entire Elasticsearch index(s) into memory. "
"If this is explicitly required and there is sufficient memory, call `ed.eland_to_pandas(ed_df).values`"
"If this is explicitly required, and there is sufficient memory, call `ed.eland_to_pandas(ed_df).values`"
)
to_numpy = values

View File

@ -878,3 +878,40 @@ class Series(NDFrame):
"""
results = super().nunique()
return results.squeeze()
#def values TODO - not implemented as causes current implementation of query to fail
def to_numpy(self):
"""
Not implemented.
In pandas this returns a Numpy representation of the Series. This would involve scan/scrolling the
entire index.
If this is required, call ``ed.eland_to_pandas(ed_series).values``, *but beware this will scan/scroll the entire
Elasticsearch index(s) into memory.*
See Also
--------
:pandas_api_docs:`pandas.DataFrame.to_numpy`
eland_to_pandas
Examples
--------
>>> ed_s = ed.Series('localhost', 'flights', name='Carrier').head(5)
>>> pd_s = ed.eland_to_pandas(ed_s)
>>> print("type(ed_s)={0}\\ntype(pd_s)={1}".format(type(ed_s), type(pd_s)))
type(ed_s)=<class 'eland.series.Series'>
type(pd_s)=<class 'pandas.core.series.Series'>
>>> ed_s
0 Kibana Airlines
1 Logstash Airways
2 Logstash Airways
3 Kibana Airlines
4 Kibana Airlines
Name: Carrier, dtype: object
"""
raise NotImplementedError(
"This method would scan/scroll the entire Elasticsearch index(s) into memory."
"If this is explicitly required and there is sufficient memory, call `ed.eland_to_pandas(ed_df).values`"
)