Find the eigenvalues of a subset of Dataframe in Python
<p>I have a matrix in the form of DataFrame </p>

<pre><code>   df=     6M         1Y         2Y         4Y         5Y        10Y        30Y
      6M   n/a        n/a        n/a        n/a        n/a        n/a        n/a
      1Y   n/a          1  0.9465095   0.869504  0.8124711    0.64687  0.5089244
      2Y   n/a  0.9465095          1  0.9343177  0.8880676  0.7423546  0.6048189
      4Y   n/a   0.869504  0.9343177          1  0.9762842  0.8803984  0.7760753
      5Y   n/a  0.8124711  0.8880676  0.9762842          1  0.9117788  0.8404656
      10Y  n/a    0.64687  0.7423546  0.8803984  0.9117788          1  0.9514033
      30Y  n/a  0.5089244  0.6048189  0.7760753  0.8404656  0.9514033          1
</code></pre>

<p>I read the values from a matrix (real numbers) and whenever there is no data I insert <code>'n/a'</code>(need to maintain this format for other reasons).
I would like to compute the eigenvalues of subset of DataFrame that contains float values (essentially subset from <code>'1Y'</code> to <code>'30Y'</code>).</p>

<p>I can extract the subset using <code>iloc</code> </p>

<pre><code>tmp = df.iloc[1:df.shapep[0],1:df.shape[1]] 
</code></pre>

<p>and this extract the correct values (check the types and they are float). But when I try to compute the eigenvalues of <code>tmp</code> using <code>np.linalg.eigvalsh</code> I get an error </p>

<pre><code>TypeError: No loop matching the specified signature and casting
was found for ufunc eigvalsh_lo
</code></pre>

<p>The strange thing is that when I start from a dataframe where <code>'n/a'</code> are replaces by <code>'0.0'</code> the the whole process can be done with no problem (it needs to be initialized by <code>0.0</code> and not for instance <code>0</code>). 
It seems that if some part of the dataframe is not real the subset extraction does not turn the values in real numbers. </p>

<p>Is there a way to overcome this problem? </p>