The "NOT IN" the filter is used to check whether a particular data is available in the DataFrame or not. The "NOT IN" the condition in pandas is checked by using the DataFrame.isin() operator.
The DataFrame.isin() operator is used to filter some specified data from the entire dataset using a list of elements that need to be excluded to filter the data.
Syntax:
DataFrame[~DataFrame[column_name].isin(list)]
Parameter: It takes DataFrame as a parameter. Secondly, it takes the column name and the list of elements that needs to be excluded.
To work with MultiIndex in Python Pandas, we need to import the pandas library. Below is the syntax,
import pandas as pd
Let us understand with the help of an example.
Output:
Peter Harry Tom John Maths 65 45 67 56 Physics 70 56 87 78 Chemistry 70 66 65 65 English 75 66 53 64 Peter Harry Tom John Maths 65 45 67 56 English 75 66 53 64need an explanation for this answer? contact us directly to get an explanation for this answer