I have a files in which data is something like this
[1,2,3,4,5]
[4,2,3,4,5,6]
[3,12,3,34,5]
[3,4,5,6,7,8]
[2,3,4,5,6,6]
[2,3,4,5,5,4,3]
[1,2,3,23,2,1]
i just want to convert this into numpy array, something like this
[[1,2,3,4,5],[4,2,3,4,5,6]]
I tried following code:
import ast
import numpy as np
a = np.array([])
with open("test.txt","r") as f:
for line in f:
line = ast.literal_eval(line)
np.append(line,a)
it is only giving []
appendand more importantly reassign to a.np.appenddoes not work in-place.