Columns are the different fields that contain their particular values when we create a DataFrame. We can perform certain operations on both rows & column values. Rows in pandas are the different cell (column) values that are aligned horizontally and also provide uniformity. Each row can have the same or different value. Rows are generally marked with the index number but in pandas, we can also assign index names according to the needs. Here, we are going to find the row whose column has the maximum value.
For this purpose, pandas provide idx.max() method, which will return that index where the column value is max. Then with the help of pandas.DataFrame.loc property, we will get the row by passing the index.
Syntax:
DataFrame.idxmax(
axis=0,
skipna=True
)
Parameter(s): It takes two parameters, axis and skipna which are usually defined to check axis and to skip the Null values respectively.
To work with pandas, we need to import pandas package first, below is the syntax:
import pandas as pd
Let us understand with the help of an example.
Output:

need an explanation for this answer? contact us directly to get an explanation for this answer