InterviewSolution
Saved Bookmarks
| 1. |
Can you get items of series A that are not available in another series B? |
|
Answer» This can be achieved by using the ~ (not/negation symbol) and isin() method as SHOWN below. import pandas as pddf1 = pd.Series([2, 4, 8, 10, 12])df2 = pd.Series([8, 12, 10, 15, 16])DF1=df1[~df1.isin(df2)]print(df1)"""Output:0 21 4dtype: int64""" |
|