About 316,000 results
Open links in new tab
  1. Calling functions by array index in Python - Stack Overflow

    Apr 18, 2011 · I have a bunch of functions in Python out1, out2, out3 etc. and would like to call them based on an integer I pass in. def arryofPointersToFns (value): #call outn where n = …

  2. How do I declare an array in Python? - Stack Overflow

    Oct 3, 2009 · @AndersonGreen As I said there's no such thing as a variable declaration in Python. You would create a multidimensional list by taking an empty list and putting other lists …

  3. Declaring a python function with an array parameters and passing …

    Or do you want the same thing done on every value/item in the array/list. If the latter is what you wish I have found a method which works well. I'm more familiar with programming languages …

  4. Passing an array/list into a Python function - Stack Overflow

    Dec 17, 2019 · The function scipy.optimize.curve_fit utilizes this as it expect the function parametrized by apriori unknown number of values, e.g. you can specify. import numpy as np …

  5. In Python how do I run an array of functions - Stack Overflow

    May 30, 2015 · Python functions are first order objects; just put them in the sequence: arr = (one, two, three) for fnc in arr: fnc() You could store strings too, but then you need to turn those back …

  6. python store function in array - Stack Overflow

    Oct 17, 2017 · I am new-ish to python, but I was wondering if it is possible to store a function in an array? I want to do an array multiplication, where the value of one array is multiplied by a …

  7. python - Modifying a list inside a function - Stack Overflow

    Suppose I have function with list parameter, and inside its body I want to modify passed list, by copying elements of an array to the list: def function1 (list_arg): a = function2() #function2 …

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

    Feb 5, 2016 · But first let's state the obvious: no matter how you map a Python-function onto a numpy-array, it stays a Python function, that means for every evaluation: numpy-array element …

  9. Pass array as argument in python - Stack Overflow

    Apr 14, 2016 · Python actually has several array types: list, tuple, and array; the popular 3rd-party module Numpy also supplies an array type. To pass a single list (or other array-like container) …

  10. python - Finding the average of a list - Stack Overflow

    Dec 8, 2023 · This is because under the hood, mean() uses statistics._sum() which returns a data type to convert the mean into (and Decimal is not on Python's number hierarchy), while …