I read my data using numpy genfromtxt:
import numpy as np measurement = np.genfromtxt('measurementProfile2.txt', delimiter=None, dtype=None, skip_header=4, skip_footer=2, usecols=(3,0,2)) rows, columns = np.shape(measurement) x=np.zeros((rows, 1), dtype=measurement.dtype) x[:]=394 measurement = np.hstack((measurement, x)) np.savetxt('measurementProfileFormatted.txt',measurement)
this works great. But I want only a 5-th , 6-th (so n-th ) line in the final Output file. According to numpy.genfromtxt.html there will be no parameter that would do this. I do not want to iterate over the array. Is there a recommended way to solve this problem?
source share