diff --git a/docs/source/reference/api/eland.DataFrame.to_numpy.rst b/docs/source/reference/api/eland.DataFrame.to_numpy.rst new file mode 100644 index 0000000..0455c77 --- /dev/null +++ b/docs/source/reference/api/eland.DataFrame.to_numpy.rst @@ -0,0 +1,6 @@ +eland.DataFrame.to_numpy +======================== + +.. currentmodule:: eland + +.. automethod:: DataFrame.to_numpy diff --git a/docs/source/reference/api/eland.DataFrame.values.rst b/docs/source/reference/api/eland.DataFrame.values.rst new file mode 100644 index 0000000..3af3afc --- /dev/null +++ b/docs/source/reference/api/eland.DataFrame.values.rst @@ -0,0 +1,6 @@ +eland.DataFrame.values +====================== + +.. currentmodule:: eland + +.. autoattribute:: DataFrame.values diff --git a/docs/source/reference/api/eland.Series.info_es.rst b/docs/source/reference/api/eland.Series.info_es.rst new file mode 100644 index 0000000..2b3b104 --- /dev/null +++ b/docs/source/reference/api/eland.Series.info_es.rst @@ -0,0 +1,6 @@ +eland.Series.info_es +==================== + +.. currentmodule:: eland + +.. automethod:: Series.info_es diff --git a/docs/source/reference/api/eland.Series.to_numpy.rst b/docs/source/reference/api/eland.Series.to_numpy.rst new file mode 100644 index 0000000..e8f73d1 --- /dev/null +++ b/docs/source/reference/api/eland.Series.to_numpy.rst @@ -0,0 +1,6 @@ +eland.Series.to_numpy +===================== + +.. currentmodule:: eland + +.. automethod:: Series.to_numpy diff --git a/docs/source/reference/dataframe.rst b/docs/source/reference/dataframe.rst index 64f5b29..4757c0c 100644 --- a/docs/source/reference/dataframe.rst +++ b/docs/source/reference/dataframe.rst @@ -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 diff --git a/docs/source/reference/series.rst b/docs/source/reference/series.rst index 366e57a..9e807aa 100644 --- a/docs/source/reference/series.rst +++ b/docs/source/reference/series.rst @@ -72,6 +72,7 @@ Serialization / IO / conversion :toctree: api/ Series.to_string + Series.to_numpy Elasticsearch utilities ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/eland/dataframe.py b/eland/dataframe.py index 53a7f76..5bead9d 100644 --- a/eland/dataframe.py +++ b/eland/dataframe.py @@ -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( - "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`" + 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`" ) - to_numpy = values diff --git a/eland/series.py b/eland/series.py index 4e39e85..b68aa7d 100644 --- a/eland/series.py +++ b/eland/series.py @@ -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)= + type(pd_s)= + >>> 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`" + )