title: how to use vstack in a for loop in order to append csr_matrix matrices together
body: <p>I am using the following piece of code in order to concatenate matrices of type <code>csr_matrix</code>  together. It is based on <a href="https://stackoverflow.com/questions/15563396/python-scipy-how-to-flatten-a-csr-matrix-and-append-it-to-another-csr-matrix">How to flatten a csr_matrix and append it to another csr_matrix?</a></p>
  
  <pre><code>#! /usr/bin/python
  # -*- coding: utf-8 -*-
  import re, sys
  import os
  import numpy
  
  from scipy.sparse import csr_matrix
  from scipy.sparse import vstack
  
  
  if __name__ == "__main__": 
  
    centroids = []
    for i in range(0,3):
      a = csr_matrix([[i,i,i]])
      centroids = vstack((centroids, a), format='csr')
  
    print "centroids : " + str(centroids.shape[0]) +"  "+ str(centroids.shape[1])
  </code></pre>
  
  <hr>
  
  <p>As output I am getting </p>
  
  <pre><code>centroids : 4  3
  </code></pre>
  
  <p>The size of centroids should be 3 and not 4. Am I concatenating them correctly?</p>
  
  <hr>
  
  <p>I tried the following just to see if I can ignore the first rows:</p>
  
  <pre><code>from sklearn.metrics.pairwise import euclidean_distances
  matrix = euclidean_distances(centroids[1:][:], centroids[1:][:])
  print matrix
  [[ 0.          1.73205081  3.46410162]
   [ 1.73205081  0.          1.73205081]
   [ 3.46410162  1.73205081  0.        ]]
  </code></pre>
  
  <p>It sounds ok to me.</p>