title: pandas dataframe.apply -- converting hex string to int number
body: <p>I am very new to both python and pandas. I would like to know how to convert dataframe elements from hex string input to integer number, also I have followed the solution provided by: <a href="https://stackoverflow.com/questions/37955856/convert-pandas-dataframe-column-from-hex-string-to-int">convert pandas dataframe column from hex string to int</a> </p>
  
  <p>However, it is still not working. The following is my code:</p>
  
  <pre><code>df = pd.read_csv(filename, delim_whitespace = True, header = None, usecols = range(7,23,2))
  for i in range(num_frame):
      skipheader = lineNum[header_padding + i*2]
      data = df.iloc[skipheader:skipheader + 164:2]
      data_numeric = data.apply(lambda x: int(x, 16))
      dataframe.append(data)
  </code></pre>
  
  <p>the data variable looks like:
  <a href="https://i.stack.imgur.com/RFNvY.png" rel="nofollow noreferrer">data variable (type:DataFrame)</a>
  also the console output in spyder:<a href="https://i.stack.imgur.com/hvfLe.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>the error happens at <code>data_numeric = data.apply(lambda x: int(x, 16))</code>
  and the error message is </p>
  
  <pre><code>TypeError: ("int() can't convert non-string with explicit base", u'occurred at index 7')
  </code></pre>
  
  <p>I had also try<code>data_numeric = data.apply(pd.to_numeric, errors='coerce')</code>
  but all the hex number turn into NaN, which is not I want.
  Any suggestions? Thanks a lot in advance!!!</p>