I have a list of couples of values, and DataFrame.
- I want to create a new DataFrame d2 containing the rows of existing DataFrame d1 where values of columns
['A','B']must be equal (bothAandBat the same time) to at least one of couples in a listcof values.
Every tuto I see check if values in a DataFrame match a fixed one-or-two-pair of values at max.
For example :
c = [[1, 100], [2,200], [3, 300], ..., [5,500]]
dfa = pd.DataFrame({"A": [1, 2, 3, 4, 5, 6], "B": [100, 200, 300, 400, 500, 600]})
At the moment, I did :
dfa[dfa[['A', 'B']].isin(c).all(axis=1)]
But it returns nothing, whereas it should return two rows ! I appreciate any help :)
You can use: