1
$\begingroup$

I will try to explain my problem. So I have two DataFrames , Df1 and Df2. Each of them has 3 columns and 4 rows. I will solve a quadratic functions with np.polyfit.

M=3

for t in range(M-1,0,-1):

  regs = np.polyfit(Df1[:,t],Df2[:,t+1],2)

  C = np.polyval(regs,Df1[:,t])

But I want to use only the values which are smaller than 1.1

 Df1[Df1 < 1.1]

Now I have something like that as Df1

[1. , 1.09, 1.08, NaN]
[1. , 1., 1.07, 1.04]
[1. , NaN, 1.01, NaN]
[1. , 0.78, NaN,0.95]

And my Df2 looks like

[0.1 , 0., 0.08, 0.]
[0.1 , 0.11, 0., 0.09]
[0.1 , 0.33, 0.22, 0.]
[0.1 , 0.09, 0.108, 0.]

So what I want to do is for each column from Df1, if Df1 has a NaN Then I don't want to calculate it.

Here is what I tried to explain (in this case for Df1[2] and Df2[3]):

X =[1.08,1.07,1.01]
Y =[0.,0.09,0]
$\endgroup$
1
  • 1
    $\begingroup$ I'm voting to close this question as off-topic because it is not related with Quantitative Finance. $\endgroup$ Commented Jan 22, 2019 at 22:02

0

Browse other questions tagged or ask your own question.