title: Integrating data from txt file in python
body: <p>I have three columns of data (time (t), Thrust (T), distance (s)) from which I would like to calculate the work performed. The text (logdata.txt) file containing the data is structured as follows:</p>
  <pre><code>time, thrust, distance
  
  1 2405 501
  2 2500 702
  3 2500 903
  4 2580 1100
  5 2610 1300 
  
  </code></pre>
  <p>The examples I have encountered only show how to use the scipy.integrate functions when setting up your own function for f(x), however in this case I have the raw data (hence no function). I would like to integrate the thrust over the distance covered using the Simpson rule. The code I use is as follows:</p>
  <pre><code>from scipy import integrate
  import numpy as np
  
  data = np.loadtxt(&quot;logdata.txt&quot;)
  
  #selecting the whole second and third column of the text file
  x = data[1]
  y = data[2]
  
  integrate.simps(y)
  </code></pre>
  <p>However, this does not give me a reasonable value. Does anyone know how to go about this?</p>