DataFrame.tail

DataFrame.tail(n: int = 5) DataFrame[source]

Return the last n rows.

This function returns the last 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 last n rows sorted by index field

See Also

:pandas_api_docs:`pandas.DataFrame.tail`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights', columns=['Origin', 'Dest'])
>>> df.tail()
                                                            Origin  \
13054                                   Pisa International Airport...
13055  Winnipeg / James Armstrong Richardson International Airport...
13056               Licenciado Benito Juarez International Airport...
13057                                                Itami Airport...
13058                               Adelaide International Airport...

                                           Dest...
13054      Xi'an Xianyang International Airport...
13055                            Zurich Airport...
13056                         Ukrainka Air Base...
13057  Ministro Pistarini International Airport...
13058   Washington Dulles International Airport...

[5 rows x 2 columns]