On Fri, Jan 26, 2018 at 2:35 PM, Allan Haldane <allanhaldane@gmail.com> wrote:As I remember, numpy has some fairly convoluted code for array creation
which tries to make sense of various nested lists/tuples/ndarray
combinations. It makes a difference for structured arrays and object
arrays. I don't remember the details right now, but I know in some cases
the rule is "If it's a Python list, recurse, otherwise assume it is an
object array".that's at least explainable, and the "try to figure out what the user means" array cratinon is pretty much an impossible problem, so what we've got is probably about as good as it can get.> These points make me think that instead of a `.totuple` method, this
> might be more suitable as a new function in np.lib.recfunctions.
>
> I don't seem to have that module -- and I'm running 1.14.0 -- is this a
> new idea?
Sorry, I didn't specify it correctly. It is "numpy.lib.recfunctions".thanks -- found it.Also, the functions in that module encourage "pandas-like" use of
structured arrays, but I'm not sure they should be used that way. I've
been thinking they should be primarily used for binary interfaces
with/to numpy, eg to talk to C programs or to read complicated binary files.that's my use-case. And I agree -- if you really want to do that kind of thing, pandas is the way to go.I thought recarrays were pretty cool back in the day, but pandas is a much better option.So I pretty much only use structured arrays for data exchange with C code....
---CHB
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy- discussion