I'm trying to get the top entry (string) in a matrix of data to be the variable name for the rest of the (numerical) data in each column. I've used the following to open the file and create the matrix.
with open('x.dat', 'r') as f:
row = 0
for line in f:
words = line.split(',')
for col in range(len(words)):
DataMatrix[row][col] = words[col]
row += 1
f.close()
However, i can't see how to take the string and have it be recognized as a variable name for the "list" of data which will be filled by the column of numerics. This has got to be simpler than I'm making it. Any help?
The data file looks like: ... (can't seem to get the format to show correctly, but each [] is a row and the rows are stacked on top of one another)
['% Time','FrameNo','Version','X','Y','Z',…]
['66266.265514','948780','2.5','64','0','30'…]
[66266.298785','948785', 2.5','63','0','32',…]
…