[SciPy-User] Does SciPy already supersed NumPy?

Yuxiang Wang yw5aj at virginia.edu
Wed Oct 1 13:36:18 EDT 2014


I was reading through the link and it mentioned that the first form is
preferred over the second one under most circumstances:

# first form
from scipy import stats
stats.lomax(...)

# second form
from scipy.stats import distributions
distributions.lomax(...)

I honestly think the second form is far more frequently used in the
examples given in the document, for example:

http://docs.scipy.org/doc/scipy/reference/tutorial/special.html
http://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html
http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
http://docs.scipy.org/doc/scipy/reference/tutorial/fftpack.html

Would you think it'd be better to update this link
http://docs.scipy.org/doc/scipy/reference/api.html#guidelines-for-importing-functions-from-scipy
 ?

-Shawn


On Tue, Sep 30, 2014 at 11:18 AM, Robert Kern <robert.kern at gmail.com> wrote:
> On Mon, Sep 29, 2014 at 5:49 PM, Sergio Rojas <sergio_r at mail.com> wrote:
>> In the not so long past we were suppose to do:
>>
>>>>> import numpy as np
>>>>> anumpy = np.arange(15).reshape(3, 5)
>>>>> anumpy
>> array([[ 0,  1,  2,  3,  4],
>>        [ 5,  6,  7,  8,  9],
>>        [10, 11, 12, 13, 14]])
>>>>> anumpy.shape
>> (3, 5)
>>>>> anumpy.ndim
>> 2
>>>>> np.array([6, 7, 8])
>> array([6, 7, 8])
>>
>> Now, one can also do:
>>
>>>>> import scipy as sp
>>>>> sp.__version__
>> '0.13.3'
>>>>> ascipy = sp.arange(15).reshape(3, 5)
>>>>> ascipy
>> array([[ 0,  1,  2,  3,  4],
>>        [ 5,  6,  7,  8,  9],
>>        [10, 11, 12, 13, 14]])
>>>>> ascipy.shape
>> (3, 5)
>>>>> ascipy.ndim
>> 2
>>>>> sp.array([6, 7, 8])
>> array([6, 7, 8])
>>
>> Is it recomended to do so?
>>
>>  Does this means that SciPy has overloaded NumPy functions or that SciPy
>> superseding NumPy?
>
> No. See this section of the documentation:
>
> http://docs.scipy.org/doc/scipy/reference/api.html#guidelines-for-importing-functions-from-scipy
>
> --
> Robert Kern
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



-- 
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj at virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/



More information about the SciPy-User mailing list