About 50 results
Open links in new tab
  1. python - Understanding the map function - Stack Overflow

    Jun 11, 2012 · The Python 2 documentation says: Built-in Functions: map (function, iterable, ...) Apply function to every item of iterable and return a list of the results. If additional iterable arguments are pa...

  2. python - Most efficient way to map function over numpy array - Stack ...

    Feb 5, 2016 · What is the most efficient way to map a function over a numpy array? I am currently doing: import numpy as np x = np.array([1, 2, 3, 4, 5]) # Obtain array of square ...

  3. Mapping arrays in Python using map, lambda, and functional …

    3 I'm trying to understand how functional programming languages work, and I decided to take the approach of program in a functional way in python, as it is the language in which I feel more …

  4. Getting a map() to return a list in Python 3.x - Stack Overflow

    list(map(chr,[66,53,0,94])) In Python 3+, many processes that iterate over iterables return iterators themselves. In most cases, this ends up saving memory, and should make things go faster. If all …

  5. python - map () a function with a numpy array and lists as arguments ...

    Oct 17, 2021 · How can you use a numpy array and lists as inputs to a map function? Here, my expected output should be an array of arrays (3 arrays long) that are each the mean of the array- …

  6. python - How to do multiple arguments to map function where one …

    map(add, [1, 2, 3], 2) The semantics are I want to add 2 to every element of the array. But the map function requires a list in the third argument as well. Note: I am putting the add example for simplicity. …

  7. Convert map object to numpy array in python 3 - Stack Overflow

    Feb 15, 2015 · 15 Although you refer to it as seq, the map object in Python 3 is not a sequence (it's an iterator, see what's new in Python 3). numpy.array needs a sequence so the len can be determined …

  8. python - Map an array into another array - Stack Overflow

    May 30, 2019 · Map an array into another array Asked 6 years, 8 months ago Modified 6 years, 8 months ago Viewed 11k times

  9. Converting string to an int array using map - Stack Overflow

    Nov 9, 2017 · You can't split on an empty string, but Python supports casting str to list as a built-in. I wouldn't use map for situations like these though, but instead use a list comprehension:

  10. python - How to map function over numpy with condition on each …

    Jul 4, 2022 · Result: array([1, 0, 1, 0, 1], dtype=int32) Note that this type of spreading isn't something that generally works - you shouldn't expect Python to just do the spreading when needed for any …