title: How to fix shapes not aligned when reading from CSV file in python
body: <p>I'm trying to import a dataset from CSV file in Python, but it showed an error of &quot;shapes not aligned&quot;. I wonder if anyone knows how to solve this.</p>
  <p>here is my code</p>
  <pre><code>import numpy as np
  from numpy import genfromtxt
  
  x = genfromtxt('problem1.csv', delimiter=',')
  
  def model(x,w):
      a = w[0] + np.dot(x.T,w[1:])
      return a.T
  
  #define sigmoid function
  def sigmoid(t):
      return 1/(1 + np.exp(-t))
  
  #the convex cross-entropy cost function
  def cross_entrypy(w):
  
      #compute sigmoid of model
      a = sigmoid(model (x,w))
  
      #compute cost of label 0 points
      ind = np.argwhere (y == 0) [:,1]
      cost = -np.sum(np.log(1 - a[:,ind]))
  
      #add cost on label 1 points
      ind = np.argwhere(y==1)[:,1]
      cost -= np.sum(np.log(a[:,ind]))
  
      #compute cross-entropy
      return cost/y.size
  
  print(cross_entrypy([3,3]))
  </code></pre>
  <p>here is my dataset looks like</p>
  <p><a href="https://i.stack.imgur.com/cHCjc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cHCjc.png" alt="enter image description here" /></a></p>
  <p>This is the error message I received
  <a href="https://i.stack.imgur.com/PWhE3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PWhE3.png" alt="enter image description here" /></a></p>
  <p>--update--</p>
  <p><a href="https://i.stack.imgur.com/Gixmh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gixmh.png" alt="enter image description here" /></a></p>
  <p>This is the practice question where the dataset is use for</p>