About 228,000 results
Open links in new tab
  1. python - Finding the average of a list - Stack Overflow

    How do I find the arithmetic mean of a list in Python? For example: [1, 2, 3, 4] 2.5

  2. Finding the mean of Python list - Stack Overflow

    Apr 23, 2022 · 3 statistics.mean() works on vanilla Python lists. It does not work on numpy.ndarray s. You should use numpy.mean() instead. Also, it looks like accuracy_list is a list containing a one …

  3. list - How to calculate mean in python? - Stack Overflow

    Dec 2, 2013 · If you're not using numpy, the obvious way to calculate the arithmetic mean of a list of values is to divide the sum of all elements by the number of elements, which is easily achieved using …

  4. Mean value of each element in multiple lists - Python

    6 What you want is the mean of two arrays (or vectors in math). Since Python 3.4, there is a statistics module which provides a mean() function: statistics.mean (data) Return the sample arithmetic mean …

  5. python - Find min, max, and average of a list - Stack Overflow

    I am having hard time to figure out how to find min from a list for example somelist = [1,12,2,53,23,6,17] how can I find min and max of this list with defining (def) a function I do not want to use

  6. What does [:-1] mean/do in python? - Stack Overflow

    Mar 20, 2013 · Working on a python assignment and was curious as to what [:-1] means in the context of the following code: instructions = f.readline()[:-1] Have searched on here on S.O. and on Google …

  7. python - How to compute the element-wise mean of a nested list with ...

    Sep 9, 2022 · Even if it were a numpy array, given that it's a jagged array, it wouldn't benefit from being wrapped in an ndarray anyway, so a list comp would still be the best option, in my opinion. Anyway, …

  8. python - What does list [x::y] do? - Stack Overflow

    Jan 27, 2012 · If you skip the end index, like in your question, it would take elements from the start index (x), pick every yth element until it reaches the end of the list if y is positive and beginning of the list if …

  9. python - Does "IndexError: list index out of range" when trying to ...

    Aug 11, 2022 · The way Python indexing works is that it starts at 0, so the first number of your list would be [0]. You would have to print [52], as the starting index is 0 and therefore line 53 is [52].

  10. What does asterisk * mean in Python? - Stack Overflow

    What does the asterisk mean when there is no argument name? For example in some functions of the class pprint.