Hello Ivan!

Thanks for your quick reply. To be more clear I am
doing some kind of a slice function where a user can
select different fields and one row or vise verse from
arbitrary number of tables. Since each field can have
different types I want to gather the data in a table
form. I thought of doing this with numpy arrays. If I
dump just one table with the flavor "numpy" I do get a
numpy array. That's what you did in pytables if I am
not wrong, so I wanted to do the same thing. I guess I
can use recarray unless you have a better idea for my
problem?
By the way, has anyone tried to implement any kind of
a slice function for arbitrary number of tables?   

Best regards, Dragan.  




--- Ivan Vilata i Balaguer <[EMAIL PROTECTED]>
wrote:

> dragan savic (el 2007-11-12 a les 08:36:25 -0800) va
> dir::
> 
> > I have a question regarding numpy arrays.
> > Lets say I have two arrays:
> > 
> > a = array([1,2,3],dtype=float32)
> > b = array([4,5,6],dtype=int16)
> > 
> > I want to build a new array like this:
> > new_array = hstack((row_stack(a),row_stack(b)))
> > 
> > The result is:
> > array([[ 1.,  4.],
> >        [ 2.,  5.],
> >        [ 3.,  6.]], dtype=float32)
> > 
> > What I was hoping was that the elements from the b
> > array remain int16. Is it possible to have
> homogeneous
> > array in numpy?
> 
> Maybe you where looking for an *heterogeneous* array
> (i.e. record array
> or table)?  In that case, the ``numpy.rec`` module
> is your friend:
> 
> >>> numpy.rec.fromarrays((a, b))
> recarray([(1.0, 4), (2.0, 5), (3.0, 6)], 
>       dtype=[('f0', '<f4'), ('f1', '<i2')])
> 
> (Or maybe you wanted to post to
> [EMAIL PROTECTED])
> 
> ::
> 
>       Ivan Vilata i Balaguer   >qo<  
> http://www.carabos.com/
>              Cárabos Coop. V.  V  V   Enjoy Data
>                                 ""
> >
-------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? 
> Stop.
> Now Search log events and configuration files using
> AJAX and a browser.
> Download your FREE copy of Splunk now >>
http://get.splunk.com/>
_______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/pytables-users
> 



      
____________________________________________________________________________________
Go from "to-do" to "done" with the all-new Yahoo! Search. Show me how.
http://tools.search.yahoo.com/newsearch/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to