arraymean#

arraymean(data, stds=2, axis=None, mean_sf=None, err_sf=None, tostring=True, doprint=False, **kwargs)[source]#

Quickly calculate the mean and standard deviation of an array.

By default, will calculate the correct number of significant figures based on the deviation. The default is to multiply the standard deviation by 2, as an approximation of the 95% confidence level (z=1.96).

Parameters:
  • data (array) – the data to summarize

  • stds (int) – the number of multiples of the standard deviation to show (default 2)

  • axis (int) – the axis of the data to operate on (default None)

  • mean_sf (int) – if provided, use this number of significant figures for the mean rather than the auto-calculated

  • err_sf (int) – ditto, but for the error (standard deviation)

  • doprint (bool) – whether to print (else, return the string)

  • kwargs (dict) – passed to sc.sigfig()

Example:

data = [1210, 1072, 1722, 1229, 1902]
sc.arraymean(data) # Returns 1430 ± 320
New in version 3.0.0.
New in version 3.2.0: “axis” argument, “tostring” argument (allow numerical output)