[Numpy-discussion] fixed_pt some progress and a question

Robert Kern robert.kern at gmail.com
Tue Sep 29 11:22:39 EDT 2009


On Tue, Sep 29, 2009 at 10:10, Neal Becker <ndbecker2 at gmail.com> wrote:

> I could force an additional conversion using np.array (xxx, dtype=float).
> Seems wasteful.

np.asarray() will not be wasteful.

> The bigger question I have is, if I've subclassed an array, how can I get at
> the underlying array type?

x.view(np.ndarray)

The .view() method serves two purposes: to create a view onto the same
memory with a new dtype but also to create a view using a different
ndarray subclass.

-- 
Robert Kern

"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 NumPy-Discussion mailing list