[Numpy-discussion] RecArray.tolist() suggestion

Colin J. Williams cjw at sympatico.ca
Fri Jul 16 05:41:12 EDT 2004


Francesc Alted wrote:

>A Divendres 16 Juliol 2004 02:21, Colin J. Williams va escriure:
>  
>
>>To allow for multi-word column names, assignment could replace a space 
>>by an underscore
>>and, in retrieval, the reverse could be done - ie. underscore would be 
>>banned for a column name.
>>    
>>
>
>That's not so easy. What about other chars like '/&%@$()' that cannot be
>part of python names? Finding a biunivocal map between them and allowed
>chars would be difficult (if possible at all). Besides, the resulting
>colnames might become a real mess.
>
>Regards,
>  
>
Yes, if the objective is to include special characters or facilitate 
multi-lingual columns names and
it probably should be, then my suggestion is quite inadequate.

Perhaps there could be a simple name -> column number mapping in place 
of _names.  References
to a column, or a field in a record, could then be through this dictionary.

Basic access to data in a record would be by position number, rather 
than name, but the dictionary
would facilitate access by name.

Data could be referenced either through the column name: r1.c2[1] or
through the record r1[1].c2, with the possibility that the index is 
multi-dimensional in either case.

Colin W.





More information about the NumPy-Discussion mailing list