title: Modify values of a numpy array based on a condition
body: <p>Hello I have a numpy array as follows:</p>
  <pre><code>list_of_values = [-0.5, -0.8, -0.6, -0.2, 0.2, 0.5, 0.7, 0.9, -0.3, 0.2, 0.6, 0.4, 0, 0.2, 0, -0.3, -0.2, 0, -0.6, 0, 0.3]
  array= np.array(list_of_values)
  </code></pre>
  <p>I need an array of the same size, having a 1 when the value goes from negative to positive, and a -1 when the value goes from positive to negative, and a 0 for the rest. If there is a 0 in list_of_values, and it bounces back, it should not be considered as the 0 line has been crossed.</p>
  <p>This is the exact output that I am looking for</p>
  <pre><code>output = [0, 0, 0, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1]
  </code></pre>
  <p>The real list_of_values is large, with 3000+ numbers, so the solution should use Numpy (some for loop is not valid), and it should be quick.</p>
  <p>Thank you</p>