title: Python - pickup data based on a list of values or conditions
body: <p>I have a data set that has 9 columns, and I managed to extract two of the columns using pandas (Thank you Stack members for your help before!). Now, my question is: I have a list of values that will be used to pickup from the data set and extract the corresponding values. The extracted data set looks like:</p>
  
  <pre><code>Exp. m/z    Intensity
  1000        2000
  2000        3000
  3000        4000
  4000        5000
  </code></pre>
  
  <p>and so on (there are about 500+ rows for each data set). The list used for pickup looks like:</p>
  
  <pre><code>mass
  1200
  1300
  </code></pre>
  
  <p>and so on (about 200 rows for the pickup list). Each mass value will be used to calculate the upper and lower bins, and they will be used to pickup the Exp. m/z values from the data set. So, for example, mass 1200 will be calculated as 1250 (upper) and 1150 (lower), and whatever falls within this range from the data set will be picked up, and their corresponding Intensity values are what I want. If none are picked up, I want the result to be empty value if possible as I believe 0 values affect average and other statistical analysis. </p>
  
  <p>Below is my code, where file is the data set and pickupfile is the pickup list:</p>
  
  <p>from pandas import DataFrame</p>
  
  <pre><code>    import pandas as pd
      import numpy as np
  
      file = 'C09.xls'
      pickupfile = 'pickuplist.xlsx'
  
      xl = pd.ExcelFile(file)
      pl = pd.ExcelFile(pickupfile)
  
      plist = pd.read_excel(xl)
      pickuplist = pd.read_excel(pl)
  
      cmass = plist['Exp. m/z']
      height = plist['Intensity']
  
  
      plistcollect = pd.concat([cmass, height], axis=1)
  
  
      ppm = 150
  
      peak1upper = round(pickuplist*(1+ppm/1000000),4)
  
      peak1lower = round(pickuplist*(1-ppm/1000000),4)
  
      pickup = plistcollect[((plistcollect['Exp. m/z']&gt;peak1lower) &amp; (plistcollect['Exp. m/z'] &lt; peak1upper))]
      print(pickup['Intensity'])
  </code></pre>
  
  <p>When I execute this code, I get an error message: ValueError: Boolean array expected for the condition, not float64.  I do understand my data set are floating values, so do you guys have some hints or tips/recommendations? </p>
  
  <p>Thank you so much!!</p>
  
  <p>EDIT:
  Forgot to mention that my data and the two limits (peak1lower &amp; peak1upper) are float64 types.</p>
  
  <p>I also tried the pickup with isin like: </p>
  
  <pre><code>    pickup = plistcollect[plistcollect.isin(np.arange(peak1lower,peak1upper))]
  </code></pre>