[Numpy-discussion] Setting custom dtypes and 1.14

Allan Haldane allanhaldane at gmail.com
Sat Jan 27 23:50:58 EST 2018


On 01/26/2018 06:01 PM, josef.pktd at gmail.com wrote:
>     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?)

No, that's still the way to do it.

*should* we have any dataframe-like functionality in numpy?

We get requests every once in a while about how to sort rows, or about 
adding a "groupby" function. I myself have used recarrays in a 
dataframe-like way, when I wanted a quick multiple-array object that 
supported numpy indexing. So there is some demand to have minimal 
"dataframe-like" behavior in numpy itself.

recarrays play part of this role currently, though imperfectly due to 
padding and cache issues. I think I'm comfortable with supporting some 
minor use of structured/recarrays as dataframe-like, with a warning in 
docs that the user should really look at pandas/xarray, and that 
structured arrays are primarily for data exchange.

(If we want to dream, maybe one day we should make a minimal 
multiple-array container class. I imagine it would look pretty similar 
to recarray, but stored as a set of arrays instead of a structured 
array. But maybe recarrays are good enough, and let's not reimplement 
pandas either.)

Allan

> 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 <tel:%28206%29%20526-6959>   voice
>     7600 Sand Point Way NE (206) 526-6329 <tel:%28206%29%20526-6329>   fax
>     Seattle, WA  98115 (206) 526-6317 <tel:%28206%29%20526-6317>   main
>     reception
> 
>     Chris.Barker at noaa.gov <mailto:Chris.Barker at noaa.gov>


More information about the NumPy-Discussion mailing list