QST: Select some data based on a condition
- [x] I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas) on StackOverflow for similar questions.

- [x] I have asked my usage related question on [StackOverflow](https://stackoverflow.com).

---

#### Question about pandas

```python
def condition(index):
    # Complex operations here, involving several external arrays queries
    # And multiple for loops
    return [ True / False ] # Returns a boolean
```

Hi!
I have a condition (like above) and a DataFrame.
How may I filter my DataFrame to only keep the rows for which the index returns True when passed to the above `condition()`?
I cannot find a way, using pandas, to pass a function to `.where()` or to `.filter()`.

Please do not hesitate if you have questions.

Thanks in advance!