DataFrame.to_numpy

DataFrame.to_numpy() None[source]

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 oml.opensearch_to_pandas(oml_df).values, but beware this will scan/scroll the entire OpenSearch index(s) into memory.

See Also

:pandas_api_docs:`pandas.DataFrame.to_numpy` opensearch_to_pandas

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> oml_df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights', columns=['AvgTicketPrice', 'Carrier']).head(5)
>>> pd_df = oml.opensearch_to_pandas(oml_df)
>>> print(f"type(oml_df)={type(oml_df)}\ntype(pd_df)={type(pd_df)}")
type(oml_df)=<class 'opensearch_py_ml.dataframe.DataFrame'>
type(pd_df)=<class 'pandas.core.frame.DataFrame'>
>>> oml_df
   AvgTicketPrice           Carrier
0      841.265642   Kibana Airlines
1      882.982662  Logstash Airways
2      190.636904  Logstash Airways
3      181.694216   Kibana Airlines
4      730.041778   Kibana Airlines

[5 rows x 2 columns]
>>> pd_df.values
array([[841.2656419677076, 'Kibana Airlines'],
       [882.9826615595518, 'Logstash Airways'],
       [190.6369038508356, 'Logstash Airways'],
       [181.69421554118, 'Kibana Airlines'],
       [730.041778346198, 'Kibana Airlines']], dtype=object)