1

AttributeError at /turboai/turboAI/jaaiparameters/ enter image description here

def transform_data(df, cols, scaler, n_days_past=120):

    n_cols = len(cols)

    # df to np array

    np_arr = np.array(df.values.flatten().tolist())

    np_arr = scaler.transform([np_arr])

    np_arr = np_arr.reshape((np_arr.shape[0], n_days_past, n_cols))

    return np_arr

1 Answers1

1

The caller pass None value in your transform_data method for scaler thats why you are getting the above error

If you are not sure about the value in scaler you can update your code like below where you first check the scaler object and then perform the operation on top of it.

def transform_data(df, cols, scaler, n_days_past=120):
    n_cols = len(cols)
    np_arr = np.array(df.values.flatten().tolist())

    if scaler:
        np_arr = scaler.transform([np_arr])
    np_arr = np_arr.reshape((np_arr.shape[0], n_days_past, n_cols))
    return np_arr
Shreeyansh Jain
  • 1,407
  • 15
  • 25