About 50 results
Open links in new tab
  1. Is arr.__len__ () the preferred way to get the length of an array in ...

    24 The preferred way to get the length of any python object is to pass it as an argument to the len function. Internally, python will then try to call the special __len__ method of the object that was passed.

  2. How do I get the number of elements in a list (length of a list) in Python?

    Nov 11, 2009 · Explanation Everything in Python is an object, including lists. All objects have a header of some sort in the C implementation. Lists and other similar builtin objects with a "size" in Python, in …

  3. python - Iterating through a for loop with the size of an array - Stack ...

    Dec 10, 2022 · Iterating through a for loop with the size of an array Asked 3 years, 1 month ago Modified 3 years, 1 month ago Viewed 21k times

  4. How do I find the length (or dimensions, size) of a numpy matrix in …

    Feb 27, 2014 · Thanks for pointing me to that question! I did try searching, but "numpy matrix dimensions" (or length or size for that matter) didn't result in anything useful. I read numpy tutorials, …

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

    a = numpy.empty(n, dtype=object) 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 …

  6. Counting array elements in Python - Stack Overflow

    Jun 29, 2016 · How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of …

  7. python - size of NumPy array - Stack Overflow

    I'm really curious why shape is an attribute of arrays and a function in the numpy model but not a method of array objects. Is there an obvious answer? Does it feel like it merits a separate SO …

  8. is there a way to know the length of a bytearray variable in python ...

    Mar 27, 2015 · Compare the easy with which we rewrite a formula like x* (a+b) into x a + x b to the clumsiness of doing the same thing using a raw OO notation. (b) When I read code that says len (x) I …

  9. python - How to make a multidimension numpy array with a varying …

    23 This isn't well supported in Numpy (by definition, almost everywhere, a "two dimensional array" has all rows of equal length). A Python list of Numpy arrays may be a good solution for you, as this way …

  10. Find length of 2D array Python - Stack Overflow

    May 23, 2012 · Find length of 2D array Python Asked 13 years, 8 months ago Modified 10 months ago Viewed 480k times