title: Creating a COO matrix from a 2D numpy array
body: <p>I have a 2D numpy array that looks like this,</p>
  
  <pre><code>[[3, 4, 5, 6], [4, 5, 6, 7], [9, 10, 3, 5]]
  </code></pre>
  
  <p>I converted this into a COO matrix using the following code:</p>
  
  <pre><code># Flatten 2D array
  data = np.asarray(twod_array).flatten()
  row = np.arange(0, len(data))
  col = np.arange(0, len(row))
  # Make COO matrix
  mat = coo_matrix((data, (row, col)), shape=(len(row), len(row)))
  </code></pre>
  
  <p>Is this the correct way of converting a 2D numpy array into a COO matrix?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>What I am trying to do is this, I have parts on one coloumn and item on the other.</p>
  
  <pre><code>parts                                 item
  processor, display, sensor            temp. monitoring system
  fan baldes, motor, sensor             motion detecting fan
          .                                       .
          .                                       .
  </code></pre>
  
  <p>I have converted the data above to numbers so that they can be further processed.</p>
  
  <pre><code>parts         items
  1, 2, 3       1
  4, 5, 3       2
  </code></pre>
  
  <p>So now, I want to feed the above data into LightFM, so I created a 2D array like this.</p>
  
  <pre><code>[[1, 2, 3, 1], [4, 5, 3, 2]]
  </code></pre>
  
  <p>But since LightFM's fit method only takes in np.float32 coo_matrix of shape [n_users, n_items] which is a matrix containing user-item interactions. I converted the 2D array using the above stated method.</p>