title: compute different thresholds for ROC with no libraries
body: <p>Trying to iterate each threshold value and extracting all required information .Inside For Loop ,apply lambda with conditional statement, not iterating entire loop.Please suggest how this can be handled efficiently. Thanks!</p>
  
  <pre><code>import pandas as pd
  df=pd.read_csv('x.csv')
  newdf=df.round({'proba':2})
  newdf.drop_duplicates(subset ="proba", inplace = True)
  newdf.sort_values(by=['proba'], ascending=False, inplace=True,ignore_index=True)
  
  import numpy as np
  proba_arr=np.array(newdf['proba'])
  for i in proba_arr:
  newdf['predict'] = newdf['proba'].apply (lambda x: 1 if x &gt;= x else 0)
  actual = newdf['y']
  predicted = newdf['predict']
  print(predicted)
  </code></pre>
  
  <p>Its executing below 2 lines only for all threshold values.Looking for each iteration one threshold value and extract its corresponding information
      for i in proba_arr:
      newdf['predict'] = newdf['proba'].apply (lambda x: 1 if x >= x else 0)</p>