Note
Pandas (7) 본문
728x90
How to get the items not common to both series A and series B?
# Input
ser1 = pd.Series([1, 2, 3, 4, 5])
ser2 = pd.Series([4, 5, 6, 7, 8])
# Solution
ser_u = pd.Series(np.union1d(ser1, ser2)) # union
ser_i = pd.Series(np.intersect1d(ser1, ser2)) # intersect
ser_u[~ser_u.isin(ser_i)]
'Pandas' 카테고리의 다른 글
Pandas (9) (0) | 2022.07.29 |
---|---|
Pandas (8) (0) | 2022.07.28 |
Pandas (6) (0) | 2022.07.26 |
Pandas (5) (0) | 2022.07.25 |
Pandas (4) (0) | 2022.07.24 |
Comments