assertEqual ( round (stdev, 2 ), 2. assertEqual (mean, 8 ) def test_calculatestdev (self ) : , 'data not read in correctly' ) def test_calculatemean (self ) : n, 20, 'n value incorrect' ) def test_readdata (self ) : read_data_file ( 'data/binary.txt' ) def test_initialization (self ) : binomial import BinomialĬlass TestBinomialClass (unittest. stdev ** 2 ) return resultįunction to output the characteristics of the Gaussian instance set_title ( 'Normal Distribution for \n Sample Mean and Sample Standard Deviation' )įunction to add together two Gaussian distributions set_title ( 'Normed Histogram of Data' )Īxes.
pdf (tmp ) ) # make the plotsįig, axes = plt. Y = # calculate the x values to visualize for i in range (n_spaces ) : Interval = 1.0 * (max_range - min_range ) / n_spaces data ) # calculates the interval between x values Probability density function along the same range Start your Jupyter notebook and type in the following in your cell. When you install, it comes with a version of Python that has the Pandas library pre-installed in it. stdev ) ** 2 ) def plot_histogram_pdf (self, n_spaces = 50 ) : """įunction to plot the normalized histogram of the data and a plot of the Reading a data file into a Python Jupyter notebook is simple. X (float): point for calculating the probability density functionįloat: probability density function output Probability density function calculator for the gaussian distribution. ylabel ( 'count' ) def pdf (self, x ) : """ Sample (bool): whether the data represents a sample or populationįloat: standard deviation of the data setįunction to output a histogram of the instance variable data using Earlier whenever I executed anything in the jupyter notebook, It showed a lengthy list of errors in the terminal(not in the notebook). I didn't fix them at the time but have decided to now.
data )ĭef calculate_stdev (self, sample = True ) : """įunction to calculate the standard deviation of the data set. I have been having issues with my jupyter notebook for a few days. _init_ (self, mu, sigma ) def calculate_mean (self ) : """įunction to calculate the mean of the data set.Īvg = 1.0 * sum (self. """ def _init_ (self, mu = 0, sigma = 1 ) :ĭistribution. Stdev (float) representing the standard deviation of the distributionĭata_list (list of floats) a list of floats extracted from the data file Mean (float) representing the mean value of the distribution Gaussian distribution class for calculating and