About 615,000 results
Open links in new tab
  1. How can I filter items from a list in Python? - Stack Overflow

    Aug 22, 2009 · 4 What about using filter function In this example we are trying to only keep the even numbers in list_1.

  2. python - List comprehension vs. lambda + filter - Stack Overflow

    The first is the function call overhead: as soon as you use a Python function (whether created by def or lambda) it is likely that filter will be slower than the list comprehension.

  3. Filtering a list of strings based on contents - Stack Overflow

    Jan 28, 2010 · This simple filtering can be achieved in many ways with Python. The best approach is to use "list comprehensions" as follows:

  4. Filter list of object with condition in Python - Stack Overflow

    Aug 5, 2021 · Filter list of object with condition in Python Asked 4 years, 4 months ago Modified 3 years, 3 months ago Viewed 24k times

  5. python - Filtering a list based on a list of booleans - Stack Overflow

    I have a list of values which I need to filter given the values in a list of booleans: list_a = [1, 2, 4, 6] filter = [True, False, True, False] I generate a new filtered list with the following l...

  6. Filter a Python list by predicate - Stack Overflow

    The () brackets make this a generator expression rather than a list comprehension. Personally though I'd just use the regular filter/comprehension and take the first element (if there is one).

  7. python - Use a list of values to select rows from a Pandas …

    list_of_values doesn't have to be a list; it can be set, tuple, dictionary, numpy array, pandas Series, generator, range etc. and isin() and query() will still work.

  8. python - How to return a subset of a list that matches a condition ...

    How to return a subset of a list that matches a condition [duplicate] Asked 9 years, 10 months ago Modified 2 years, 6 months ago Viewed 101k times

  9. python - Regular expression to filter list of strings matching a ...

    Mar 14, 2013 · Regular expression to filter list of strings matching a pattern Asked 12 years, 9 months ago Modified 2 years, 11 months ago Viewed 22k times

  10. python - Filter dataframe rows if value in column is in a set list of ...

    Aug 22, 2012 · 134 isin() is ideal if you have a list of exact matches, but if you have a list of partial matches or substrings to look for, you can filter using the str.contains method and regular …