title: Why do I get the 'loop of ufunc does not support argument 0 of type int' error for numpy.exp?
body: <p>I have a dataframe and I'd like to perform exponential calculation on a subset of rows in a column. I've tried three versions of code and two of them worked. But I don't understand why one version gives me the error.</p>
  
  <pre><code>import numpy as np
  </code></pre>
  
  <p>Version 1 (working)</p>
  
  <pre><code>np.exp(test * 1.0)
  </code></pre>
  
  <p>Version 2 (working)</p>
  
  <pre><code>np.exp(test.to_list())
  </code></pre>
  
  <p>Version 3 (Error)</p>
  
  <pre><code>np.exp(test)
  </code></pre>
  
  <p>It shows the error below:</p>
  
  <pre><code>AttributeError                            Traceback (most recent call last)
  AttributeError: 'int' object has no attribute 'exp'
  
  The above exception was the direct cause of the following exception:
  
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-161-9d5afc93942c&gt; in &lt;module&gt;()
  ----&gt; 1 np.exp(pd_feature.loc[(pd_feature[col] &gt; 0) &amp; (pd_feature[col] &lt; 700), col])
  
  TypeError: loop of ufunc does not support argument 0 of type int which has no callable exp method
  </code></pre>
  
  <p>The test data is generated by:</p>
  
  <pre><code>test = pd.loc[(pd['a'] &gt; 0) &amp; (pd['a'] &lt; 650), 'a']
  </code></pre>
  
  <p>The data in test is just:</p>
  
  <pre><code>0      600
  2      600
  42     600
  43     600
  47     600
  60     600
  67     600
  Name: a, dtype: Int64
  </code></pre>
  
  <p>and its data type is:</p>
  
  <pre><code>&lt;class 'pandas.core.series.Series'&gt;
  </code></pre>
  
  <p>However, if I try to generate a dummy dataset, it works:</p>
  
  <pre><code>data = {'a':[600, 600, 600, 600, 600, 600, 600], 'b': ['a', 'a', 'a', 'a', 'a', 'a', 'a']} 
  
  df = pd.DataFrame(data) 
  
  np.exp(df.loc[:,'a'])
  </code></pre>
  
  <p>Any idea of why I see this error? Thank you very much.</p>