pandas logical operators on columns code example
Example 1: or condition in pandas
df2 = df[(df.a != -1) | (df.b != -1)]
Example 2: pandas and operator
# Loads dataset
df = pd.read_csv('dataset.csv')
# Filter data
filtered_df = df.loc[(df['column1'] == var1) & (df['column2'] == var2)]