About 121,000 results
Open links in new tab
  1. How do I declare an array in Python? - Stack Overflow

    Oct 3, 2009 · super mad props for this answer. I've been programming in Python for years and only recently realized that there was an actual Python array object that is different from list …

  2. Array of arrays (Python/NumPy) - Stack Overflow

    Aug 19, 2012 · I am using Python/NumPy, and I have two arrays like the following: array1 = [1 2 3] array2 = [4 5 6] And I ...

  3. Python list vs. array – when to use? - Stack Overflow

    Aug 17, 2022 · array.array is also a reasonable way to represent a mutable string in Python 2.x (array('B', bytes)). However, Python 2.6+ and 3.x offer a mutable byte string as bytearray . …

  4. python - array.array versus numpy.array - Stack Overflow

    Jun 21, 2022 · In defense of array.array, I think its important to note that it is also a lot more lightweight than numpy.array, and that saying 'will do just fine' for a 1D array should really be …

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

    I'm also going to assume that you mean "list" when you say "array." Sven Marnach's solution is good. If you are going to be doing repeated checks on the list, then it might be worth …

  6. How to declare and add items to an array in Python

    Python's array module. The standard library also has the array module, which is a wrapper over C arrays. Like C arrays, array.array objects hold only a single type (which has to be specified at …

  7. Initialising an array of fixed size in Python - Stack Overflow

    This creates an array of length n that can store objects. It can't be resized or appended to. In particular, it doesn't waste space by padding its length. This is the Python equivalent of Java's. …

  8. What is the best way to create a string array in python?

    The best and most convenient method for creating a string array in python is with the help of NumPy library. Example: import numpy as np arr = np.chararray((rows, columns)) This will …

  9. How to merge multiple arrays in python? - Stack Overflow

    Right now I'm able to read the files, process their data, but I struggle with the resulting multiple arrays. I wasn't able to merge them correctly. I've got a 3d array (time,long,lat) containing my …

  10. How to create an integer array in Python? - Stack Overflow

    Dec 7, 2009 · Use the array module. With it you can store collections of the same type efficiently. >>> import array >>> import itertools >>> a = array_of_signed_ints = array.array("i", …