Load Txt File Into Numpy Array
I want to load a txt file into a numpy array. The file has this format: 1,10,1,11,1,13,1,12,1,1,9 2,11,2,13,2,10,2,12,2,1,9 3,12,3,11,3,13,3,10,3,1,9 4,10,4,11,4,1,4,13,4,12,9 4,1,
Solution 1:
You need to specify the delimiter as ,
:
import numpy as np
data = np.loadtxt("file.txt", delimiter=",")
Post a Comment for "Load Txt File Into Numpy Array"