Tutorials References Exercises Sign Up Menu
Create Website Get Certified Pro

Pandas DataFrame gt() Method

❮ DataFrame Reference


Find which values are greater than 7:

import pandas as pd

df = pd.DataFrame([[10, 12, 2], [3, 4, 7]])

Try it Yourself »

Definition and Usage

The gt() method compares each value in a DataFrame to check if it is greater than a specified value, or a value from a specified DataFrame objects, and returns a DataFrame with boolean True/False for each comparison.


dataframe.gt(other, axis, level)


Parameter Description
other Required. A number, list of numbers, or another object with a data structure that fits with the original DataFrame.
axis Optional, A definition that decides whether to compare by index or columns.
0 or 'index' means compare by index.
1 or 'columns' means compare by columns
level Optional. A number or label that indicates where to compare.

Return Value

A DataFrame object.

❮ DataFrame Reference