Error Running python forecasting in Tableau

0 votes

I'm quite new to this system as well as python. As a result, there may be a few lines in the code that are redundant.

I'm attempting to forecast y (CARA Flows) with the help of x (Hybrid MF). Despite the fact that the identical code works flawlessly in Python, I'm receiving an issue in Tableau. I can see the proper forecasts in the error pane (as well as prediction for the next 12 months).

There are no issues with the integration as well. Could someone please explain the situation to me?

SCRIPT_REAL(
"
import pandas as pd
import numpy as np

dateparse = lambda dates: pd.datetime.strptime(dates, '%Y%m')
data = pd.read_excel('S:\AIM India\Anup\Requests_2018\CTI_Forecasting_Tableau\Forecast_CTI_2.xlsx',parse_dates=['YYYYMM'], index_col='YYYYMM',date_parser=dateparse)

ts_exogenMF = data['Hybrid_MF'] 

from statsmodels.tsa.arima_model import ARIMA
model = ARIMA(ts_exogenMF,order=(2, 0, 2))  
results_ARIMA1 = model.fit(disp=-1)  
forecast1,std,conf=results_ARIMA1.forecast(steps=12,alpha=0.5)
forecastMF=forecast1
MF_Arr=[]
MF_Arr=forecastMF

ts = data['CARA_Flows'] 
from statsmodels.tsa.stattools import adfuller
ts_log = np.log(ts)
ts_log_diff = ts_log - ts_log.shift()

model = ARIMA(ts_log,exog=ts_exogenMF,order=(2, 0, 2))  
results_ARIMA2 = model.fit(disp=1)  
Final_Untransformed_Forecast=results_ARIMA2.predict(start=1, end=46, exog=MF_Arr,  dynamic=False)
predictions_ARIMA_log = pd.Series(ts_log.ix[0], index=ts_log.index)
predictions_ARIMA_cumsum = predictions_ARIMA_log.add(Final_Untransformed_Forecast,fill_value=0)
predictions_12M = np.exp(Final_Untransformed_Forecast)

return predictions_12M

",SUM([Hybrid MF]), SUM([CARA Flows]))
image


Mar 31, 2022 in Tableau by Vaani
• 7,070 points
442 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Tableau

0 votes
1 answer

How to get Tableau results in python?

Well even I was looking for the ...READ MORE

answered Apr 9, 2018 in Tableau by ffdfd
• 5,550 points
900 views
0 votes
1 answer

Error: Comaparing date value with YEAR in Tableau

You have to ensure that the comparisons ...READ MORE

answered Jul 11, 2018 in Tableau by ffdfd
• 5,550 points
667 views
0 votes
1 answer
0 votes
0 answers

Using Python and Tableau in conjunction with one another

Is it possible to mix Python visualisations ...READ MORE

Feb 28, 2022 in Tableau by Vaani
• 7,070 points
512 views
0 votes
0 answers

Getting prep_int() not defined error in tableau prep

I'm using Tableau Prep with Python Script, ...READ MORE

Mar 2, 2022 in Tableau by Vaani
• 7,070 points
722 views
0 votes
1 answer

How to upload data to Tableau Server in Python

Then install the tableau-api-lib utility for Python ...READ MORE

answered Mar 4, 2022 in Tableau by Neha
• 9,020 points
2,216 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP