About 615,000 results
Open links in new tab
  1. 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.

  2. 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.

  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. 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.

  5. 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

  6. Get unique values from a list in python - Stack Overflow

    Oct 15, 2012 · 1538 First declare your list properly, separated by commas. You can get the unique values by converting the list to a set.

  7. 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

  8. Python: filtering lists by indices - Stack Overflow

    Jan 20, 2016 · In Python I have a list of elements aList and a list of indices myIndices. Is there any way I can retrieve all at once those items in aList having as indices the values in myIndices? …

  9. filtering elements from list of lists in Python? - Stack Overflow

    Apr 16, 2010 · I want to filter elements from a list of lists, and iterate over the elements of each element using a lambda. For example, given the list: a = [[1,2,3],[4,5,6]] suppose that I want to …

  10. 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...