cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
aallman
Level III

Data Table Column With Matrix Values

I have a table with a column that contains a matrix in every row. I am writing a script to search within the matrix of a specific row. However, the problem I am running into is that when I try to retrieve a value from that column it returns as " { [1, 2, 3, 4] } " instead of as a matrix. This means I cannot use the Loc() function that I need. I figured out that if I subscript the list with a 1 (as in :Col[row][1]) then I get rid of the list brackets but I am still left with the matrix as a string ( "[1, 2, 3, 4]" ) and I still cannot use it in matrix functions. 

 

What am I doing wrong and how can I get this to work???

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: Data Table Column With Matrix Values

My guess is that the column has a data type of character.

You can convert the string to a list using Parse, then take the first element as a matrix:

value = " { [1, 2, 3, 4] } ";
lst = Parse(value);
show(lst);
mat = lst[1];
show(mat);
-Dave

View solution in original post

1 REPLY 1
David_Burnham
Super User (Alumni)

Re: Data Table Column With Matrix Values

My guess is that the column has a data type of character.

You can convert the string to a list using Parse, then take the first element as a matrix:

value = " { [1, 2, 3, 4] } ";
lst = Parse(value);
show(lst);
mat = lst[1];
show(mat);
-Dave