Python Pandas 'isin' function | Search the values of a column in another column in any row

preview_player
Показать описание
Python Pandas 'isin' function | Search the values of a column in another column in any row

Python for Machine Learning - Session # 93

Topic to be covered - How to search the value of one column in any of the record of other column.

Pandas 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.

Code Starts Here
=================

import pandas as pd

df = pd.DataFrame()

df['col1'] = ['Imran','Kazi','Amar','Ramesh','Steve']
df['col2'] = ['Simran','Steve','Rejish','Imran','Estefan']

df['exist1'] = df['col1'].isin(df['col2'])

df['exist2'] = df['col2'].isin(df['col1'])

df[df['exist1'] == True]
df[df['exist2'] == True]

All the playlist of this youtube channel
========================================

1. Data Preprocessing in Machine Learning

2. Confusion Matrix in Machine Learning, ML, AI

3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz

4. Cross Validation, Sampling, train test split in Machine Learning

5. Drop and Delete Operations in Python Pandas

6. Matrices and Vectors with python

7. Detect Outliers in Machine Learning

8. Time Series pre-processing in Machine Learning

9. Handling Missing Values in Machine Learning

10. Dummy Encoding Encoding in Machine Learning

11. Data Visualisation with Python, Seaborn, Matplotlib

12. Feature Scaling in Machine Learning

13. Python 3 basics for Beginner

14. Statistics with Python

15. Data Preprocessing in Machine Learning

16. Sklearn Scikit Learn Machine Learning

17. Linear Regression, Supervised Machine Learning

18 Interview Questions on Machine Learning, Artificial Intelligence, Python Pandas and Python Basics

19. Jupyter Notebook Operations
Рекомендации по теме
Комментарии
Автор

Nice . This actually work. Is there a way to put more than one columns. Say if i want col1 to match col2 to col50?

Dopeboyz
Автор

Or can you search isin row instead of columns?

Dopeboyz
Автор

How will we do to check only for adjacent rows ?

careerzoid
visit shbcf.ru