Skip to main content

#Input0 discutindo

2 respostas
0/9000

#Input

 

{

 

"street": "ABCS",

 

"code": "1234"

 

}

If sizeOf(code)>10 I need to append with street like "ABCD 1234" and remove the code key.

#Input

{

"street": "ABCS",

"code": "12345678910"

}

#Output

{

"street": "ABCS 12345678910"

}

 

Like that if sizeOf(code)<10 and street= null. I need to remove street key.

#Input

{

"street": null,

"code": "12345"

}

#Output

{

"code": "12345"

}

If sizeOf(code)>10 and street = null remove the code key and add the value to street.

#Input

{

"street": null,

"code": "12345678910"

}

#Output

{

"street": "12345678910"

}

I need to get all these scenarios in single response. Can anyone help me on this.

 

Regards

Niranjan K

3 respostas
  1. 12 de mai. de 2022, 11:44

    @Mohammed Abdul Khader Sufi​ 

     

    Thanks for you response.

     

    But I need to verify both the fields. Last condition is not working. If code > 10 and street =null remove code and paste whatever the value coming from code to street.

     

    Is it possible to write down the condition in below similar way.

    {

    "street": condition,

    "code": condition

    }

     

    Regards

    Niranjan K

0/9000

Hi Everyone,

 

Am trying to integrate a python model with a tableau worksheet. I have anaconda and python nstalled and Tabpy is connected and works properly.

 

SCRIPT_INT("

  import pickle

  import pandas as pd

  import numpy as np

  from pandas import Series,DataFrame

 

  filename = 'C:/aaaTENNIS-DATA/votingC.pkl'

  loaded_model = pickle.load(open(filename,'rb'))

 

  ##input =np.array([[0.7,0.7,0.3,0.3]])

  input =np.array([[_arg1,_arg2,_arg3,_arg4]])

 

  Prediction = loaded_model.predict(input)

  return 3

",

0.7,0.7,0.3,0.3)

 

This fails with error message;

 

An error occurred while communicating with the Analytics Extension.

Error processing script

ValueError : Found array with dim 3. Estimator expected <= 2.

 

If I try it like this it runs without error, even though it is using the same 4 values .

 

SCRIPT_INT("

  import pickle

  import pandas as pd

  import numpy as np

  from pandas import Series,DataFrame

 

  filename = 'C:/aaaTENNIS-DATA/votingC.pkl'

  loaded_model = pickle.load(open(filename,'rb'))

 

  input =np.array([[0.7,0.7,0.3,0.3]])

  #input =np.array([[_arg1,_arg2,_arg3,_arg4]])

 

  Prediction = loaded_model.predict(input)

  return 3

",

0.7,0.7,0.3,0.3)

 

Any help appreciated.

 

Thanks,

 

Neil.

2 respostas
  1. 4 de jan. de 2022, 14:49

    Hi Dene,

    Yes, everything installed and working

0/9000