DataFrame.idxmax

DataFrame.idxmax(axis: int = 0) Series[source]

Return index of first occurrence of maximum over requested axis.

NA/null values are excluded.

Parameters

axis{0, 1}, default 0

The axis to filter on, expressed as index (int).

Returns

pandas.Series

See Also

:pandas_api_docs:`pandas.DataFrame.idxmax`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> oml_df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights')
>>> oml_flights = oml_df.filter(["AvgTicketPrice", "FlightDelayMin", "dayOfWeek", "timestamp"])
>>> oml_flights.idxmax()
AvgTicketPrice    1843
FlightDelayMin     109
dayOfWeek         1988
dtype: object