pandas dataframe select rows not in list

Do you want to know the details about “pandas dataframe select rows not in list”. If yes, you’re in the correct post.

pandas dataframe select rows not in list

In [1]: df = pd.DataFrame('A': [5,6,3,4], 'B': [1,2,3,5])

In [2]: df
Out[2]:
   A  B
0  5  1
1  6  2
2  3  3
3  4  5

In [3]: df[df['A'].isin([3, 6])]
Out[3]:
   A  B
1  6  2
2  3  3
df[df['Your_Column'].isin([3, 6])]
df[~df.isin(subset).iloc[:,0]]
In [4]: df[~df['A'].isin([3, 6])]
Out[4]:
   A  B
0  5  1
3  4  5

Final Thoughts

I hope this article helps you to know about “pandas dataframe select rows not in list”. If you have any queries regarding this tutorial please let us know via the comment section. Share this post with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment