Skip to main content

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 个回答
  1. 2022年1月4日 14:49

    Hi Dene,

    Yes, everything installed and working

0/9000