Getting started with Scipy/NumPy

Robert Kern robert.kern at gmail.com
Wed Mar 15 12:53:00 EST 2006


tkpmep at hotmail.com wrote:
> I installed SciPy and NumPy (0.9.5, because 0.9.6 does not work with
> the current version of SciPy), and had some teething troubles. I looked
> around for help and observed that the tutorial is dated October 2004,
> and is not as thorough as Python's documentation. Is there an
> alternative source of information that lists all the functions and
> their usage?

http://www.scipy.org/doc/api_docs/

> I tried using scipy.info to get information on the std function in the
> stats libary, and ran into the following problem.
> 
>>>>x = [1, 2, 3, 4]
>>>>import scipy
>>>>scipy.std(x)
> 
> 1.2909944487358056
> 
>>>>scipy.info(std)
> 
> Traceback (most recent call last):
>   File "<pyshell#6>", line 1, in -toplevel-
>     scipy.info(std)
> NameError: name 'std' is not defined

You would need to do

  scipy.info(scipy.std)

>>>>scipy.info(stats)
> 
> Traceback (most recent call last):
>   File "<pyshell#7>", line 1, in -toplevel-
>     scipy.info(stats)
> NameError: name 'stats' is not defined
> 
>>>>scipy.info(stats.std)
> 
> Traceback (most recent call last):
>   File "<pyshell#11>", line 1, in -toplevel-
>     scipy.info(stats.std)
> NameError: name 'stats' is not defined
> 
> However, If I redo the import as follows I can get help on std:
> 
>>>>from scipy import *
>>>>info(std)
> 
>  std(a, axis=0, dtype=None)
> 
> None
> 
> Question: why did it work this time and not on my first attempt?

Because you did a different kind of import on the second attempt.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list