DataFrame.head
- DataFrame.head(n: int = 5) DataFrame [source]
Return the first n rows.
This function returns the first n rows for the object based on position. The row order is sorted by index field. It is useful for quickly testing if your object has the right type of data in it.
Parameters
- n: int, default 5
Number of rows to select.
Returns
- opensearch_py_ml.DataFrame
opensearch_py_ml DataFrame filtered on first n rows sorted by index field
See Also
Examples
>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights', columns=['Origin', 'Dest']) >>> df.head(3) Origin Dest 0 Frankfurt am Main Airport Sydney Kingsford Smith International Airport 1 Cape Town International Airport Venice Marco Polo Airport 2 Venice Marco Polo Airport Venice Marco Polo Airport [3 rows x 2 columns]