Given two pandas series, how can I find which elements are in 1 but not another? All elements within each series are unique.
For example, consider the following code :
a = pd.Series([1,2,3,4])
b = pd.Series([3,2,4])
How would I be able to determine which elements are in Series 'a' but not in Series 'b'? In this example, the output would be [1].
Do you mean what are the unique values? For example if you have
a = pd.series([1,1,1,2])
b = pd.series([1,3])
The output should be [1] or [1,1,1] ?
If [1] you can use:
set(a) - set(b)
set(a) - set(b)
guess this should help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With