1In [1]: df = pd.DataFrame({'A': [5,6,3,4], 'B': [1,2,3,5]})
2
3In [2]: df
4Out[2]:
5 A B
60 5 1
71 6 2
82 3 3
93 4 5
10
11In [3]: df[df['A'].isin([3, 6])]
12Out[3]:
13 A B
141 6 2
152 3 3
1# Creating sets
2A = {1, 2, 3}
3B = {1, 2, 3, 4, 5}
4
5# Checking if A is subset of B (vice versa)
6# Returns True
7# A is subset of B
8print(A.issubset(B))
9
10# Returns False
11# B is not subset of A
12print(B.issubset(A))
1df.iloc[[1, 5]] # Get rows 1 and 5
2df.iloc[1:6] # Get rows 1 to 5 inclusive
3df.iloc[[1, 5], df.columns.get_loc('Shop')] # Get only specific column
4df.iloc[[1, 5], df.columns.get_indexer(['Shop', 'Category'])] # Get multiple columns