On Wed, May 19, 2010 at 4:08 PM, Darren Dale <dsdale24@gmail.com> wrote:
I have a question about creation of numpy arrays from a list of objects, which bears on the Quantities project and also on masked arrays:
import quantities as pq import numpy as np a, b = 2*pq.m,1*pq.s np.array([a, b]) array([ 12., 1.])
Why doesn't that create an object array? Similarly:
m = np.ma.array([1], mask=[True]) m masked_array(data = [--], mask = [ True], fill_value = 999999)
np.array([m]) array([[1]])
This has broader implications than just creating arrays, for example:
np.sum([m, m]) 2 np.sum([a, b]) 13.0
Any thoughts?
These are "array_like" of floats, so why should it create anything else than an array of floats. It's the most common usecase "array_like" is the most popular type for parameters in the docstrings Josef
Thanks, Darren _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion