Re: [Numpy-discussion] How to merge or SQL join record arrays in Python?
On May 11, 2009, at 5:44 PM, Wei Su wrote: Coming from SAS and R, this is probably the first thing I want to do now that I can convert my data into record arrays. But I could not find any clues after googling for a while. Any hint or suggestions will be great! That depends what you want, actually, ut this should get you started http://docs.scipy.org/doc/numpy/user/basics.rec.html Note the slight difference between a structured array (fields accessible as items) and a recarray (fields accessible as items and attributes). ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How to merge or SQL join record arrays in Python?
Hi, Pierre: Thanks for the reply. I can now actually turn a big list into a record array. My question is actually how to join related record arrays in Python. This is done in SAS by MERGE and PROC SQL and by merge() in R. But I have no idea how to do it in Python. Thanks. Wei Su --- On Mon, 5/11/09, Pierre GM pgmdevl...@gmail.com wrote: From: Pierre GM pgmdevl...@gmail.com Subject: Re: [Numpy-discussion] How to merge or SQL join record arrays in Python? To: Discussion of Numerical Python numpy-discussion@scipy.org Date: Monday, May 11, 2009, 10:03 PM On May 11, 2009, at 5:44 PM, Wei Su wrote: Coming from SAS and R, this is probably the first thing I want to do now that I can convert my data into record arrays. But I could not find any clues after googling for a while. Any hint or suggestions will be great! That depends what you want, actually, ut this should get you started http://docs.scipy.org/doc/numpy/user/basics.rec.html Note the slight difference between a structured array (fields accessible as items) and a recarray (fields accessible as items and attributes). ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How to merge or SQL join record arrays in Python?
On May 11, 2009, at 6:18 PM, Wei Su wrote: Thanks for the reply. I can now actually turn a big list into a record array. My question is actually how to join related record arrays in Python.. This is done in SAS by MERGE and PROC SQL and by merge() in R. But I have no idea how to do it in Python. OK. Try numpy.lib.recfunctions.join_by, and let me know if you have any problem. It's a rewritten version of an equivalent function in matplotlib (matplotlib.mlab.rec_join), that should work (maybe not, there hasn't been enough testing feedback to judge...) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How to merge or SQL join record arrays in Python?
On Mon, May 11, 2009 at 6:18 PM, Wei Su taste_o...@yahoo.com wrote: Hi, Pierre: Thanks for the reply. I can now actually turn a big list into a record array. My question is actually how to join related record arrays in Python.. This is done in SAS by MERGE and PROC SQL and by merge() in R. But I have no idea how to do it in Python. Thanks. Wei Su Does merge_arrays in numpy.lib.recfunctions do what you want? Skipper ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How to merge or SQL join record arrays in Python?
On May 11, 2009, at 6:36 PM, Skipper Seabold wrote: On Mon, May 11, 2009 at 6:18 PM, Wei Su taste_o...@yahoo.com wrote: Hi, Pierre: Thanks for the reply. I can now actually turn a big list into a record array. My question is actually how to join related record arrays in Python.. This is done in SAS by MERGE and PROC SQL and by merge() in R. But I have no idea how to do it in Python. Thanks. Wei Su Does merge_arrays in numpy.lib.recfunctions do what you want? Probably not. merge_arrays is close to concatenate, and will raise an exception if 2 fields have the same name (in the flattened version). Testing R's merge(), join_by looks like the corresponding function. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion