title: Creating multiple arrays within a for loop (Python)
body: <p>I'm currently having an issue with Numpy arrays. If this question has already been asked elsewhere, I apologize, but I feel that I have looked everywhere. </p>
  
  <p>My initial issue was that I was attempting to create an array and fill it with multiple sets of station data of different sizes. Since I cannot fill the same array with data sets that vary in size, I decided I need to create a new array for each station data set by defining the array inside the for loop I'm using to iterate through each station data set. The problem with this is that, while looping through, each data set will overwrite the previous data set, returning only the final instance of the for loop. </p>
  
  <p>Then, I tried using the + and then the join operations to concatenate a new title for each array, but turns out that is illegal when defining arrays. This is the instance of the program where each data array overwrites the previous one. Note that not all the code is included and that this is part of a definition.</p>
  
  <pre><code>for k in range(len(stat_id)):
  
      ## NOTE - more code precedes this final portion of the for loop, but was
      ## not included as it is unrelated to the issue at hand.
  
      # Bring all the data into one big array.
      metar_dat = np.zeros((len(stat_id),len(temp),7), dtype='object')
      for i in range(len(temp)):
          metar_dat[k,i] = np.dstack((stat_id[k], yr[i], month[i], day[i], time[i], temp[i], dwp[i]))
      #print np.shape(metar_dat[k])
      #print metar_dat[k]
  
  #print np.shape(metar_dat) # Confirm success with shape read.
  return metar_dat
  </code></pre>
  
  <p>Upon running and printing the array from this definition, I get this (two empty arrays and a final filled array):</p>
  
  <pre><code>[[[0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  ..., 
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]]
  
  [[0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  ..., 
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]
  [0 0 0 ..., 0 0 0]]
  
  [[\TZR 2015 7 ..., 2342 58 48]
  [\TZR 2015 7 ..., 2300 59 47]
  [\TZR 2015 7 ..., 2200 60 48]
  ..., 
  [\TZR 2015 7 ..., 0042 56 56]
  [\TZR 2015 7 ..., 0022 56 56]
  [\TZR 2015 7 ..., 0000 56 56]]]
  </code></pre>
  
  <p>My question is this: </p>
  
  <p>How can I create an array for each set of station data such that I do not overwrite any previous data? </p>
  
  <p>Or </p>
  
  <p>How can I create a single array that contains data sets with varying numbers of rows? </p>
  
  <p>I am still new to Python (and new to posting here) and any ideas would be much appreciated.</p>