From charlesreid1

(Created page with "=Arrays= ==Initializing an empty array== From <source lang="python"> In [62]: x=[] In [63]: x=np.array(x) In [64]: x Out[64]: array([], dtype=float64) In [66]: x = np.arra...")
 
No edit summary
Line 3: Line 3:
==Initializing an empty array==
==Initializing an empty array==


From
Sometimes you want to initalize an empty array, which is a really inefficient use of memory for large matrices but you could care less if it's a dozen items.


<source lang="python">
<source lang="python">

Revision as of 19:27, 28 July 2013

Arrays

Initializing an empty array

Sometimes you want to initalize an empty array, which is a really inefficient use of memory for large matrices but you could care less if it's a dozen items.

In [62]: x=[]

In [63]: x=np.array(x)

In [64]: x
Out[64]: array([], dtype=float64)

In [66]: x = np.array([],dtype=np.float64)

In [67]: x
Out[67]: array([], dtype=float64)