Problems in the Results print()

Asked

Viewed 92 times

1

I’m writing a code that calculates probabilities based on a particular Excel database.

When doing this in Excel I have the final result in the column "Probability3 %":

Resultados

Now I need to do the same, but in Python. So, I made a code similar to the one used in Excel, the problem is that when combining the probabilities with:

matriz=np.array([[R], [R1], [R2], [R5], [R6], [R7]])

and subsequently:

Probabilidades=np.max(matriz, axis=0)

the result of the print is:

[[ 57.35 100.    52.4  100.    50.    50.     0.    57.35  62.64  89.27
  100.   100.   100.    50.    50.   100.    50.   100.    50.  ]]

[R’s] are lists similar to the final result, (in Excel they are calculated in columns from "L%" to "6º"). The problem is that when doing by this method (in python) I lose some results (because it should have 29 and not only 19 presented), not to mention that I can not insert the text results, as exemplified in Excel... [R’s] calculation is made like this:

if row['Data'] < 10: 
        n=(0.5+L/100+c1*0.5)*100
        R5.append(n)
    else:
        n=0
        R5.append(n)

text results I’m trying to insert like this:

if row['Data'] >= 0 and row['Teste']=='kkk':
    b2="Vistoria Recomendada"
    R8.append(b2)

I have been advised to do it in pandas.Dataframe, but I can not insert the elements "LSE" and I do not know if I will have the same problem in the final presentation of results... for now I have something like:

 a = df[(df['data'].str.contains('xy')) | (df['data'].str.contains('xx'))
   x = a[a['outro']<7]['outro']
   L = (-0.0003*x**6)

here should still have an "Else" for "a[['other']>=7]['other']"... and then I have to do this for the other columns and have as a result something equal to the column "Probability3 %" (in Excel)...

current result:

[list([100.0, 57.34999999999999, 62.63999999999997, 0, 100, 100, 52.40000000000031, 100.0, 0, 0, 0, 57.34999999999999, 62.63999999999997, 89.27000000000007, 100, 100, 0, 0, 100, 0, 50.0, 0, 0, 100.0, 100, 0, 0, 100.0, 0, 50.0])]
  • 1

    Please be more careful when creating a question and use titles only when they are titles.

  • What is the current result? I know it is different than expected, but what?

  • edited the question

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.