title: How to remove elements from a list by index
body: <p>I am a python beginner. The data I am given in a text file(.txt) that contains my x and y values. x and y values are tab separated.</p>
  
  <pre><code>(x values)    (y values)
  113           0
  116           2
  119           0
  214           3
  220           0
  230           3
  290           5
  </code></pre>
  
  <p>My task is to remove x and y values when y value is 0.</p>
  
  <pre><code>import numpy as np
  
  files = ['my_data.txt']
  
  for file in files:
      data = np.loadtxt(file,unpack=True)
  
  
  y_value = data[1,0:]
  
  y_list= list(y_value)
  
  a= np.where(y_list==0)
  b = str(a)
  d= del.y_list(b) 
  </code></pre>
  
  <p>What I attempted to do was to identify the indexes that contains zero and remove those elements based on indices. The given code doesn't seem to work. The error message says <code>d= del.y_list(b)</code> contains invalid syntax. </p>
  
  <p>Could someone please explain what is going wrong with <code>d= del.y_list(b)</code>? Or alternatively, please feel free to share any other more efficient ways to accomplish the task. </p>
  
  <p>(The code above describes removing zero elements from y only. I thought that if this works for y values I could recall x values using <code>data[0,0:]</code>.)</p>