title: Element-wise sum of arrays in loop python
body: <p>I am trying to make a loop that reads some arrays and then it calculates the element-wise sum of the arrays. A function that does this for 2 arrays is the numpy.add. In my case, I want to build a loop to do this for more than 3 arrays.</p>
  
  <p>e.g. 
  file_1, file_2 and file_3 are arrays : [[1,2],[3,4]] , [[5,6],[7,8]] , [[9,10],[11,12]]</p>
  
  <p>My code:</p>
  
  <pre><code>import pandas as pd
  
  # load files
  x1 = pd.read_csv('file_1.csv')
  x2 = pd.read_csv('file_2.csv') 
  x3 = pd.read_csv('file_3.csv') 
  # Calculate the sum of these arrays.
  X = x1 + x2 + x3
  </code></pre>
  
  <p>The above works fine.
  Goal: to make a loop that does the above.</p>
  
  <p>Attempt:</p>
  
  <pre><code>n=4
  for i in range(1,n):
      x = pd.read_csv('file_{}.csv'.format(i),header=None)
      print(x)
      x += x
  print(x)
  </code></pre>
  
  <p>the result is not correct. Any tip?</p>
  
  <p>Edit:
  SOLVED the answer is below </p>