Browsing index pages (3 articles)
↧
How to define dictionary structure in ndarray
I want to create a 3 dimensional array with each value in the array represents a dictionary. For example: myArray[m][n][k] of type {'position':(0,0), 'boundary': [(8,8)(512,512)]}I know that, it could...
View ArticleAnswer by tktk for How to define dictionary structure in ndarray
AFAIK there is none. The best you can do is define dtype = object (which is what you'll get if you try setting dtype=dict, for example) - and then populate it manually. Nothing will ensure the...
View ArticleAnswer by immerrr for How to define dictionary structure in ndarray
If you only need named columns and the column set is immutable, you can use record arrays:In [30]: arr = np.zeros((3,3), dtype=[('position', 'f8', 2), ('boundary', 'i8', (2,2))]); arrOut[30]:...
View Article
Browsing index pages (3 articles)