filter rows pandas

newdf = df[(df.origin == "JFK") & (df.carrier == "B6")]

Here is what the above code is Doing:
1. We’re creating a new dataframe called newdf that contains only the rows from df that have an origin of JFK and a carrier of B6.
2. We’re using the & operator to specify that we want both of these conditions to be true.
3. We’re using the == operator to check if the origin and carrier columns are equal to JFK and B6.
4. We’re using the [] operator to select only the rows that satisfy our conditions.