stats#

Utility functions for calculating summary statistics.

Functions

get_summary_statistics(data, with_median)

Calculate the summary statistics for the given set of points.

Classes

SummaryStatistics(x_mean, y_mean, x_stdev, ...)

Named tuple containing the summary statistics for plotting/analysis.

class data_morph.data.stats.SummaryStatistics(x_mean: float, y_mean: float, x_stdev: float, y_stdev: float, correlation: float, x_median: float | None, y_median: float | None)[source]#

Bases: NamedTuple

Named tuple containing the summary statistics for plotting/analysis.

correlation: float#

Alias for field number 4

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

x_mean: float#

Alias for field number 0

x_median: float | None#

Alias for field number 5

x_stdev: float#

Alias for field number 2

y_mean: float#

Alias for field number 1

y_median: float | None#

Alias for field number 6

y_stdev: float#

Alias for field number 3

data_morph.data.stats.get_summary_statistics(data: pd.DataFrame, with_median: bool) SummaryStatistics[source]#

Calculate the summary statistics for the given set of points.

Parameters:
  • data (pandas.DataFrame) – A dataset with columns x and y.

  • with_median (bool) – Whether to include the median of x and y.

Returns:

Named tuple consisting of mean and standard deviations of x and y, along with the Pearson correlation coefficient between the two, and optionally, the median of x and y.

Return type:

SummaryStatistics