[Numpy-discussion] Setting custom dtypes and 1.14

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Jan 26 18:01:52 EST 2018


On Fri, Jan 26, 2018 at 5:48 PM, Chris Barker <chris.barker at noaa.gov> wrote:

> On Fri, Jan 26, 2018 at 2:35 PM, Allan Haldane <allanhaldane at 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....
>


My impression is that this turns into a deprecate recarrays and supporting
recfunction issue.

recfunctions and the associated function from matplotlib.mlab where
explicitly designed for using structured dtypes as dataframe_like.

(old question: does numpy have a sort_rows function now without detouring
to structured dtype views?)

Josef
<all code needs to be rewritten every 5 to 10 years.>



>
> -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 at noaa.gov
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180126/75b5ec18/attachment-0001.html>


More information about the NumPy-Discussion mailing list