title: Weird bug in Pandas and Numpy regarding multithreading
body: <p>Most of the Numpy's function will enable multithreading by default.</p>
  
  <p>for example, I work on a 8-cores intel cpu workstation, if I run a script</p>
  
  <pre><code>import numpy as np    
  x=np.random.random(1000000)
  for i in range(100000):
      np.sqrt(x)
  </code></pre>
  
  <p>the linux <code>top</code> will show 800% cpu usage during running like
  <a href="https://i.stack.imgur.com/2x85C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2x85C.png" alt="enter image description here"></a> 
  Which means numpy automatically detects that my workstation has 8 cores, and <code>np.sqrt</code> automatically use all 8 cores to accelerate computation.</p>
  
  <p>However, I found a weird bug. If I run a script</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  df=pd.DataFrame(np.random.random((10,10)))
  df+df
  x=np.random.random(1000000)
  for i in range(100000):
      np.sqrt(x)
  </code></pre>
  
  <p>the cpu usage is 100%!!.
  <a href="https://i.stack.imgur.com/1IwQj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1IwQj.png" alt="enter image description here"></a> <strong>It means that if you plus two pandas DataFrame before running any numpy function, the auto multithreading feature of numpy is gone without any warning!</strong> This is absolutely not reasonable, why would Pandas dataFrame calculation affect Numpy threading setting? Is it a bug? How to work around this?</p>
  
  <hr>
  
  <p>PS:</p>
  
  <p>I dig further using Linux <code>perf</code> tool.</p>
  
  <p>running first script shows</p>
  
  <p><a href="https://i.stack.imgur.com/N6Vhh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N6Vhh.png" alt="enter image description here"></a></p>
  
  <p>While running second script shows</p>
  
  <p><a href="https://i.stack.imgur.com/J3df0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/J3df0.png" alt="enter image description here"></a></p>
  
  <p>So both script involves <code>libmkl_vml_avx2.so</code>, while the first script involves additional <code>libiomp5.so</code> which seems to be related to openMP.</p>
  
  <p>And since vml means intel vector math library, so according to vml doc I guess at least below functions are all automatically multithreaded</p>
  
  <p><a href="https://i.stack.imgur.com/pSONf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pSONf.png" alt="enter image description here"></a></p>