[Numpy-discussion] how to use the name of a ndarray as a string

Chao YUE chaoyuejoy@gmail....
Thu Nov 10 04:17:15 CST 2011


Hi,

Does anyone know how I can quickly use the name of a ndarray as a string?
for example, I have
In [54]: index=np.arange(100)

then I want to use the name 'index' as a key in a new dictionary:
d3=dict()
d3['index']=index

I can do it like the way above, but I have many ndarray variables that need
to be included in the dictionary.
is there something like:
d3[index.name()]=index
while index.name() would equal the string 'index'?

I hope my question is clear. thanks to all.

Chao
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20111110/ca0e9f82/attachment.html 


More information about the NumPy-Discussion mailing list