Question

How to implement multiple filters for checking data cell in a range ?

Suppose, I have a list of numbers like,


range_1 = [ 70 ,15,5,7,3,7,8,3,2, 63  ]

# and

range_1 = [ 50, 56, 80, 61, 83, 87, 13, 58, 43, 24, 84, 54, 64,36, 48  ]

And I want to check any column values exist within these two lists.


Any suggestion would be appreciated


Was it helpful?

Solution

data.loc[ data['age'].isin(range_1) & data['height'].isin(range_2) ]
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top