[Numpy-discussion] Join and stacking for structured arrays

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Fri Sep 6 13:06:23 EDT 2013


For the astropy Table class (which wraps numpy structured arrays), I
wrote functions that perform table joins and concatenate tables along
rows or columns.  These are reasonably full-featured and handle most
of the common needs for these operations.  The join function here
addresses some limitations in the lib.recfunctions.join_by() function.
You can see the documentation for the Table interface to these
functions at [1].

The reason I'm writing is that the implementation is split into a pure
numpy-based module (no astropy dependence [5]) and the astropy bit.
Essentially all of the real work is done in the numpy-based module, so
I'm wondering if the numpy project is interested in this code for
inclusion into numpy.  If so, I'd be happy to put together a pull
request.  I would just need direction on:
 - Where to put it
 - What function names to use
-  How to setup for included Cython code

The Python and Cython code and tests can be see at [2], [3], [4].  The
tests are currently based on astropy Tables, so these would be
modified to use plain ndarray or masked arrays.

Cheers,
Tom

[1]: http://astropy.readthedocs.org/en/latest/table/operations.html
[2]: https://github.com/astropy/astropy/blob/master/astropy/table/np_utils.py
[3]: https://github.com/astropy/astropy/blob/master/astropy/table/_np_utils.pyx
[4]: https://github.com/astropy/astropy/blob/master/astropy/table/tests/test_operations.py
[5]: There is a requirement for an OrderedDict which is currently
provided by astropy for python 2.6.



More information about the NumPy-Discussion mailing list