Getting data into an array in NumPy from an other object?

Greg Ewing see_reply_address at something.invalid
Wed Sep 18 19:52:53 EDT 2002


Maurice van de Rijzen wrote:

> Dear all,
> I've encountered a problem.
> In one object I've a function:
> 
> class blah:
>     ...
>     ...
>     def GetData(self):
>         return self.data
> 
> 
> Now I want to put his data into an instance of Numeric.array.


You'll have to tell us more about the nature of your
data object before we can give you much help!

If it's a sequence (i.e. a list or tuple) or something
which behaves like a sequence (i.e. len(data) and data[i]
work) you should be able to just pass it directly to the
Numeric.array constructor.

If not, you'll have to tell us more about it.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list