title: how define function automatically select all level in column and execute command
body: <p>In this dataframe i want that level gets automatically selected from segment column and perform rest operation. I tried this but in this i need to change level every time. How to automate it?</p>
  <pre class="lang-py prettyprint-override"><code>yy = pd.DataFrame({'segment':['High','High', 'premium','local','local','local'],'value':[12,'NAN',13,'NAN',14,15]})
  
  level='High'
  def seg(temp):
      **temp1 = yy[yy['segment'] == level]**
      temp2= temp1.replace(&quot;NAN&quot;, 0)
     return temp2
  seg(yy)
  </code></pre>