Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
isin() method is used to filter data frames.
isin() method helps in selecting rows with having a particular(or Multiple) value in a particular column.
values: iterable, Series, List, Tuple, DataFrame or dictionary to check in the caller Series/Data Frame.
Return Type: DataFrame of Boolean of Dimension.
To download the CSV file used, Click Here.
Example #1: Single Parameter filtering
In the following Example, Rows are checked and a boolean series is returned which is True wherever Gender=”Male”. Then the series is passed to data frame to see new filtered data frame.
As shown in the output image, only Rows having gender = “Male” are returned.
Example #2: Multiple parameter Filtering
In the following example, the data frame is filtered on the basis of Gender as well as Team. Rows having Gender=”Female” and Team=”Engineering”, “Distribution” or “Finance” are returned.
As shown in the output image, Rows having Gender=”Female” and Team=”Engineering”, “Distribution” or “Finance” are returned.
- Python | pandas.to_markdown() in Pandas
- Python | pandas.map()
- Python | Pandas dataframe.std()
- Python | Pandas Series.dt.day
- Python | Pandas Series.ne()
- Python | Pandas Series.sem()
- Python | Pandas Series.eq()
- Python | Pandas Series.iat
- Python | Pandas Series.between()
- Python | Pandas Dataframe.at[ ]
- Python | Pandas.melt()
- Python | Pandas DataFrame.where()
- Python | Pandas dataframe.sem()
- Python | Pandas Dataframe.iat[ ]
- Python | Pandas TimedeltaIndex.name
- Python | Pandas Series.mod()
- Python | Pandas dataframe.min()
- Python | Pandas TimedeltaIndex.contains
- Python | Pandas Series.dt.second
- Python | Pandas dataframe.mul()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.