Get the items which are not common of two Pandas series
Pandas does not support specific methods to perform set operations. However, we can use the following formula to get unique items from both the sets :
- Import the
- Create 2
- Find the union of the series using the
- Find the intersection of the series using the
- Find the difference between the union and the intersection elements. Use the
isin()method to get the boolean list of items present in both ‘union’ and ‘intersect’.
- Print the result
1, 2, 6, 7
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course