About 452,000 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 …

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

    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 …

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

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

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

  5. len () of a numpy array in python - Stack Overflow

    Mar 29, 2017 · Explains how to use len() to determine the size of a numpy array in Python, with examples and discussions on its functionality.

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

  7. numpy - TypeError: only length-1 arrays can be converted to …

    TypeError: only length-1 arrays can be converted to Python scalars while plot showing Asked 9 years, 8 months ago Modified 3 years, 9 months ago Viewed 586k times

  8. python - How to create a numpy array of arbitrary length strings ...

    177 You can do so by creating an array of dtype=object. If you try to assign a long string to a normal numpy array, it truncates the string:

  9. python - How to count items in JSON data - Stack Overflow

    Dec 5, 2014 · How I can get the number of elements in node of JSON data? JSON:

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