About 39,300,000 results
Open links in new tab
  1. Find element in Array - Python - GeeksforGeeks

    Nov 28, 2024 · Here are a few of the most common ways to find an item in a Python array. in operator is one of the most straightforward ways to check if an item exists in an array. It …

  2. python - Check if item is in an array / list - Stack Overflow

    You can also use the same syntax for an array. For example, searching within a Pandas series: ser = pd.Series(['some', 'strings', 'to', 'query']) if item in ser.values: # do stuff

  3. Python: find position of element in array - Stack Overflow

    There is a built in method for doing this: numpy.where() You can find out more about it in the excellent detailed documentation.

  4. Python: finding an element in a list - Stack Overflow

    The best way is probably to use the list method .index. For the objects in the list, you can do something like: def __eq__(self, other): return self.Value == other.Value with any special …

  5. python find in array

    Python has a method to search for an element in an array, known as index (). Arrays start with the index zero (0) in Python: If you would run x.index (‘p’) you would get zero as output (first …

  6. python - Find a value in a list - Stack Overflow

    There is an abstraction in here to define a find function. Just encapsulate the the boolean expession of the if in a lambda & you can write find(fn,list) usually instead of obfuscating …

  7. python - Find object in list that has attribute equal to some value ...

    I want to find one (first or whatever) object in this list that has an attribute (or method result - whatever) equal to value. What's the best way to find it? Here's a test case: def __init__(self, …

  8. How To Check If An Array Contains A Value In Python?

    Dec 26, 2024 · Learn how to check if an array (or list) contains a value in Python. Explore methods like in, loops, and NumPy for efficient, step-by-step solutions with examples

  9. 5 Effective Python Techniques to Search for an Element in an Array

    Feb 26, 2024 · The simplest way to search for an element in an array in Python is by using the in keyword. This method performs a linear search over the array and returns True if the element …

  10. python - Check element exists in array - Stack Overflow

    Dec 20, 2011 · If you want to check whether "key" exists in "array", you must first tell what type in Python it is, because they throw different errors when the "key" is not present:

Refresh