datasets¶
Module for managing sample/population data
class DataSet: contains sample or population data
class DataSets: base class for managing data sets
- final class boring_math.probability_distributions.datasets.DataSet¶
Bases:
objectClass containing sample or population data.
all data internally stored as floats (even integer data)
data sorted smallest to largest
methods provided to
read in data from a file
computing data statistics
add or remove data
- classmethod read_data_from_file(file_name: str, sample: bool = False) MayBe[Self]¶
Read in data from a text file, return a DataSet object.
The text file should
have one number (float) per line and calculate statistics
if sample is true (default), calculate sample stats
if sample is false, calculate population stats
blank lines and lines beginning with ‘#’ are ignored
- __init__(*data: int | float, sample: bool = False) None¶
- _calculate_stats() None¶
Calculate data statistics
- _calculate_mean() MayBe[float]¶
Calculate the mean of the data set, if it exists.
- _calculate_stdev() MayBe[float]¶
From the data set, calculate & return the stdev if it exists.
If sample is True, calculate a sample standard deviation
If sample is False, calculate a population standard deviation
- _calculate_quartiles() MayBe[tuple[float, float, float]]¶
Calculate first, second (median), and third quartiles
Using the “trimmed mid-range” of the data.