a python string:
'[[4,2],[8,5]]'
for example, where you have a fairly complex multidimensional array of information, maybe is extracted from a file or user input and is naturally a string. How should I go about turning this into an actual array. I want a general implementation so that I can perform this to any multidimensional and complex array. This is for a machine learning project, and any of these arrays can be represented with a shape (e.g. (3,2,5)
) and a list of its corresponding values (e.g. [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]
) such that is may look like:
[[[1,2,3,4,5],
[6,7,8,9,0]],
[[1,2,3,4,5],
[6,7,8,9,0]],
[[1,2,3,4,5],
[6,7,8,9,0]]]