ANN: stats 0.1a calculator statistics for Python

Discussion in 'Python' started by Steven D'Aprano, Oct 17, 2010.

  1. I am pleased to announce the first public release of stats for Python.

    http://pypi.python.org/pypi/stats

    stats is a pure-Python module providing basic statistics functions
    similar to those found on scientific calculators. It currently includes:

    Univariate statistics including:
    * arithmetic, harmonic, geometric and quadratic means
    * median, mode
    * standard deviation and variance (sample and population)

    Multivariate statistics including:
    * Pearson's correlation coefficient
    * covariance (sample and population)
    * linear regression

    and others.

    This is an unstable alpha release of the software. Feedback and
    contributions are welcome.



    --
    Steven D'Aprano
     
    Steven D'Aprano, Oct 17, 2010
    #1
    1. Advertising

  2. Steven D'Aprano wrote:
    > I am pleased to announce the first public release of stats for Python.
    >
    > http://pypi.python.org/pypi/stats
    >
    > stats is a pure-Python module providing basic statistics functions
    > similar to those found on scientific calculators. It currently includes:
    >
    > Univariate statistics including:
    > * arithmetic, harmonic, geometric and quadratic means
    > * median, mode
    > * standard deviation and variance (sample and population)
    >
    > Multivariate statistics including:
    > * Pearson's correlation coefficient
    > * covariance (sample and population)
    > * linear regression
    >
    > and others.
    >
    > This is an unstable alpha release of the software. Feedback and
    > contributions are welcome.
    >
    >
    >
    >

    I already have a stats module:
    /usr/lib/python2.5/site-packages/stats.py

    """
    stats.py module

    (Requires pstat.py module.)

    #################################################
    ####### Written by: Gary Strangman ###########
    ####### Last modified: May 10, 2002 ###########
    #################################################

    A collection of basic statistical functions for python. The function
    names appear below.
    [snip]
    """


    It looks like it is part of the standard debian python distro (python
    2.5). That would mean that 'sats' is already used.

    JM
     
    Jean-Michel Pichavant, Oct 18, 2010
    #2
    1. Advertising

  3. Steven D'Aprano

    Tim Wintle Guest

    Tim Wintle, Oct 18, 2010
    #3
  4. 2010/10/17 Steven D'Aprano <>:
    > I am pleased to announce the first public release of stats for Python.
    >
    > http://pypi.python.org/pypi/stats
    >
    > stats is a pure-Python module providing basic statistics functions
    > similar to those found on scientific calculators. It currently includes:
    >
    > Univariate statistics including:
    > * arithmetic, harmonic, geometric and quadratic means
    > * median, mode
    > * standard deviation and variance (sample and population)
    >
    > Multivariate statistics including:
    > * Pearson's correlation coefficient
    > * covariance (sample and population)
    > * linear regression
    >
    > and others.
    >
    > This is an unstable alpha release of the software. Feedback and
    > contributions are welcome.
    >
    >
    >
    > --
    > Steven D'Aprano
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >

    Thanks for this useful module!
    I just wanted to report a marginal error triggered in the doctests:

    Failed example:
    isnan(float('nan'))
    Exception raised:
    Traceback (most recent call last):
    File "C:\Python25\lib\doctest.py", line 1228, in __run
    compileflags, 1) in test.globs
    File "<doctest __main__.isnan[0]>", line 1, in <module>
    isnan(float('nan'))
    ValueError: invalid literal for float(): nan

    (python 2.5.4 on win XP; this might be OS specific; probably in the
    newer versions float() was updated, the tests on 2.6 and 2.7 are ok ):

    I too would be interested in a comparison with the older module with
    the same name:
    http://www.nmr.mgh.harvard.edu/Neural_Systems_Group/gary/python.html
    which is likely to be the same as the above mentioned one.

    vbr
     
    Vlastimil Brom, Oct 18, 2010
    #4
  5. On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:

    > I already have a stats module:
    > /usr/lib/python2.5/site-packages/stats.py


    The name of my module is not set in stone.

    I can't help what site-packages you have, but the above is not on PyPI,
    and it's certainly not part of the standard library.

    If my module (or one like it) gets accepted for the standard library, I
    don't think that could happen until version 3.3. When that happens, a
    name will be chosen. Until then, I've got the first package on PyPI
    called stats, and I'm keeping it :)

    It may not stay stats forever, since it is uncomfortably close to the
    stat module.



    --
    Steven
     
    Steven D'Aprano, Oct 18, 2010
    #5
  6. On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote:

    > Steven D'Aprano <> writes:
    >
    >> On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
    >>
    >> > I already have a stats module:
    >> > /usr/lib/python2.5/site-packages/stats.py

    >>
    >> The name of my module is not set in stone.
    >>
    >> I can't help what site-packages you have, but the above is not on PyPI,
    >> and it's certainly not part of the standard library.

    >
    > How did you determine that? Unfortunately, the name of the package
    > listed on PyPI bears no relation to the name of packages installed into
    > Python.


    Fair point.



    --
    Steven
     
    Steven D'Aprano, Oct 19, 2010
    #6
  7. Steven D'Aprano wrote:
    > On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote:
    >
    >
    >> Steven D'Aprano <> writes:
    >>
    >>
    >>> On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
    >>>
    >>>
    >>>> I already have a stats module:
    >>>> /usr/lib/python2.5/site-packages/stats.py
    >>>>
    >>> The name of my module is not set in stone.
    >>>
    >>> I can't help what site-packages you have, but the above is not on PyPI,
    >>> and it's certainly not part of the standard library.
    >>>

    >> How did you determine that? Unfortunately, the name of the package
    >> listed on PyPI bears no relation to the name of packages installed into
    >> Python.
    >>

    >
    > Fair point.
    >
    >
    >

    It's part of the debian distribution. Just sayin so you know :).

    apt-cache showpkg python-stats
    Package: python-stats
    Versions:
    0.6-7
    (/var/lib/apt/lists/apt-cache.sequans.com_debian_dists_lenny_main_binary-i386_Packages)
    (/var/lib/dpkg/status)


    JM
     
    Jean-Michel Pichavant, Oct 19, 2010
    #7
  8. Steven D'Aprano

    Chris Torek Guest

    >2010/10/17 Steven D'Aprano <>:
    >> http://pypi.python.org/pypi/stats


    In article <>
    Vlastimil Brom <> wrote:
    >Thanks for this useful module!
    >I just wanted to report a marginal error triggered in the doctests:
    >
    >Failed example:
    > isnan(float('nan'))
    >Exception raised:
    > Traceback (most recent call last):
    > File "C:\Python25\lib\doctest.py", line 1228, in __run
    > compileflags, 1) in test.globs
    > File "<doctest __main__.isnan[0]>", line 1, in <module>
    > isnan(float('nan'))
    > ValueError: invalid literal for float(): nan
    >
    >(python 2.5.4 on win XP; this might be OS specific; probably in the
    >newer versions float() was updated, the tests on 2.6 and 2.7 are ok ):


    Indeed it was; in older versions float() just invoked the C library
    routines, so float('nan') works on Mac OS X python 2.5, for instance,
    but then you run into the fact that math.isnan() is only in 2.6 and
    later :)

    Workaround, assuming an earlier "from math import *":

    try:
    isnan(0.0)
    except NameError:
    def isnan(x): x != x

    Of course you are still stuck with float('nan') failing on Windows.
    I have no quick and easy workaround for that one.
    --
    In-Real-Life: Chris Torek, Wind River Systems
    Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
    email: gmail (figure it out) http://web.torek.net/torek/index.html
     
    Chris Torek, Oct 19, 2010
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Tam
    Replies:
    2
    Views:
    422
    John Rivers
    Aug 27, 2005
  2. Gerson Kurz
    Replies:
    0
    Views:
    379
    Gerson Kurz
    Dec 4, 2003
  3. Raymond L. Buvel

    ANN: rpncalc-1.0 RPN Calculator For Python

    Raymond L. Buvel, Nov 28, 2004, in forum: Python
    Replies:
    0
    Views:
    303
    Raymond L. Buvel
    Nov 28, 2004
  4. Steven D'Aprano
    Replies:
    0
    Views:
    219
    Steven D'Aprano
    Nov 14, 2010
  5. Steven D'Aprano
    Replies:
    0
    Views:
    218
    Steven D'Aprano
    Dec 31, 2010
Loading...

Share This Page