Say I have a .txt file with many rows and columns of data and a list containing integer values. How would I load the row numbers in the text file which match the integers in the list?
To illustrate, say I have a list of integers:
a = [1,3,5]
How would I read only rows 1,3 and 5 from a text file into an array?
The loadtxt routine in numpy let's you both skip rows and use particular columns. But I can't seem to find a way to do something along the lines of (ignoring incorrect syntax):
new_array = np.loadtxt('data.txt', userows=a, unpack='true')
Thank you.