title: Why does this array-reshaping routine work outside of a function but not inside of a function?
body: <p>I am trying to convert a list into a numpy array with a specified number of columns. I can get the code to work outside the function as follows:</p>
  
  <pre><code>import numpy as np
  
  ls = np.linspace(1,100,100) # Data Sample
  ls = np.array(ls) # list --&gt; array
  
  # resize | outside function
  ls.resize(ls.shape[0]//2,2)
  print(ls)
  
  &gt;&gt; [[   1.    2.]
      [   3.    4.]
             .
             .
             .
      [  97.   98.]
      [  99.  100.]]
  </code></pre>
  
  <p>I do not understand my error when trying to throw the routine in a function. My attempt is as follows:</p>
  
  <pre><code># resize | inside function
  def shapeshift(mylist, num_col):
      num_col = int(num_col)
      return mylist.resize(mylist.shape[0]//num_col,num_col)
  
  ls = shapeshift(ls,2)
  print(ls)
  
  &gt;&gt; None
  </code></pre>
  
  <p>I want to define the original function in this way because I want another function, consisting of the same inputs and a third input to loop over rows when extracting values, to call this original function for each loop over rows.</p>