title: numpy ndarray object has no attribute append
body: <p>I am struggling with a program I am making on the part where I have to store values that I get from my loop in an array.</p>
  <p>What I tried to do is to make an empty array called M. Then for every new value &quot;a&quot; calculated in a loop I use the command M.append(a) to add the value a to the array M.</p>
  <p>The thing is, python says this error : 'numpy.ndarray' object has no attribute 'append'</p>
  <p>and I don't know how to fix it.</p>
  <p>Here is my code :</p>
  <pre><code>import numpy as np
  from matplotlib import pyplot as plt
  with open('expFcn0.txt') as f:
      M = np.array([])
      print(M)
      lines = f.readlines()
      x = [float(line.split()[0]) for line in lines]
      y = [float(line.split()[1]) for line in lines]
      for i in range(0,181):
          a=np.log(y[i])/x[i]
          print(a)
          i=i+1
          M.append(a)
      print(M)
  
      
      plt.plot(x, y, 'r--')
      plt.xlabel('Time')
      plt.ylabel('Biomass')
      plt.title('Exponential Function')
      plt.show()
  </code></pre>
  <p>Thank you very much!</p>