About 2,600,000 results
Open links in new tab
  1. python - Standard deviation of a list - Stack Overflow

    In Python 2.7.1, you may calculate standard deviation using numpy.std() for: Population std: Just use numpy.std() with no additional arguments besides to your data list. Sample std: You need to pass ddof (i.e. Delta Degrees of Freedom) set to 1, as in the following example: numpy.std(< your-list >, ddof=1)

  2. python - Standard deviation in numpy - Stack Overflow

    By default, numpy.std returns the population standard deviation, in which case np.std([0,1]) is correctly reported to be 0.5. If you are looking for the sample standard deviation, you can supply an optional ddof parameter to std(): >>> np.std([0, 1], ddof=1) 0.70710678118654757

  3. python - How do I read from stdin? - Stack Overflow

    Sep 20, 2009 · $ python -c "from io import open; open(1,'w').write(open(0).read())" < inputs.txt foo bar baz Addressing other comments and answers One comment suggests ''.join(sys.stdin) for golfing but that's actually longer than sys.stdin.read() - plus Python must create an extra list in memory (that's how str.join works when not given a list) - for contrast:

  4. python - Plot mean and standard deviation - Stack Overflow

    May 23, 2017 · I have several values of a function at different x points. I want to plot the mean and std in python, like the answer of this SO question. I know this must be easy using matplotlib, but I have no i...

  5. python - Calculating standard deviation of a sample - Stack Overflow

    Sep 9, 2018 · This looks a bit confusing. When you need to calculate the std, you can easily use np.std(). And Std is square root of variance. However, when we calculate variance of a sample, we divide it by n-1. So if we use np.std() this shouldn't give us a correct output.

  6. python - Weighted standard deviation in NumPy - Stack Overflow

    Mar 9, 2010 · def weighted_sample_avg_std(values, weights): """ Return the weighted average and weighted sample standard deviation. values, weights -- Numpy ndarrays with the same shape. Assumes that weights contains only integers (e.g. how many samples in each group).

  7. numpy - How can I simply calculate the rolling/moving variance of …

    Despite being an old thread, I'll add another method modified from this, that doesn't rely on pandas, nor python loops. Essentially, using numpy's stride tricks you can first create a view of an array with striding such that computing a statistic of the function along the last axis is equivalent to performing the rolling statistic.

  8. logging - Making Python loggers output all messages to stdout in ...

    Oct 25, 2018 · In Python 3 at least, it looks like omitting stream=sys.stdout still works for logging to the console for me. – Taylor D. Edmiston Commented May 20, 2018 at 2:29

  9. printing - How do I print to stderr in Python? - Stack Overflow

    Under Python 2.6 there is a future import to make print into a function. So to avoid any syntax errors and other differences we should start any file where we use print() with from future import print_function. The future import only works under Python 2.6 and later, so for Python 2.5 and earlier you have two options. You can either convert the ...

  10. Box plot with min, max, average and standard deviation

    Aug 30, 2023 · Given the information available (mean, standard deviation, min, max), errorbar is probably the only graph that can be plotted but if, say, you want to plot a box plot from aggregated data, matplotlib has bxp() method that can be used.

Refresh