Unable to forecast the data in tableau using tapy

I am currently wanting to forecast a data using sarimax in tabpy, but i am getting the error of value count mismatch. How can i show the tableau forecasted values and the dates returned by the script dataframe.

code to get previous and forecasted values:

SCRIPT_REAL(
"
import pandas as pd
import numpy as np
from statsmodels.tsa.statespace.sarimax import SARIMAX

#create dataframe

df=pd.DataFrame(
{'Close Date':_arg1,
'Line Amount(MINR)':_arg2
}
)


# Convert dates to datetime format

df['Close Date'] = pd.to_datetime(df['Close Date'])

# Set the date as index
df.set_index('Close Date', inplace=True)



daily_sales_filtered = df['Line Amount(MINR)'].resample('D').sum()


# Fit SARIMA model to the filtered data
seasonal_order_ = (1, 1, 1, 12)  # Example seasonal order, you may need to tune (P, D, Q, s)
model = SARIMAX(daily_sales_filtered, order=(5, 1, 0), seasonal_order=seasonal_order_)
model_fit = model.fit()

# Forecast future sales
forecast_steps = _arg3[0]
forecast = model_fit.forecast(steps=forecast_steps)

previous_forecast = df['Line Amount(MINR)'].tolist()

previous_forecast.extend(forecast.tolist())

return previous_forecast
"
,
ATTR([Close Date]),
ATTR([Line Amount(MINR)]),
[Months Forecast],
ATTR([EXTEND CLOSE DATE]))

code to get previous and forecasted dates:

DATE(SCRIPT_STR(
"
import pandas as pd
import numpy as np
from statsmodels.tsa.statespace.sarimax import SARIMAX

#create dataframe

df=pd.DataFrame(
{'Close Date':_arg1,
'Line Amount(MINR)':_arg2
}
)


# Convert dates to datetime format

df['Close Date'] = pd.to_datetime(df['Close Date'])

# Set the date as index
df.set_index('Close Date', inplace=True)



daily_sales_filtered = df['Line Amount(MINR)'].resample('D').sum()


# Fit SARIMA model to the filtered data
seasonal_order_ = (1, 1, 1, 12)  # Example seasonal order, you may need to tune (P, D, Q, s)
model = SARIMAX(daily_sales_filtered, order=(5, 1, 0), seasonal_order=seasonal_order_)
model_fit = model.fit()

# Forecast future sales
forecast_steps = _arg3[0]
forecast = model_fit.forecast(steps=forecast_steps)

previous_forecast_date = [date.strftime('%Y-%m-%d') for date in df.index.to_pydatetime()]

previous_forecast_date.extend([date.strftime('%Y-%m-%d') for date in forecast.index.to_pydatetime()])

return previous_forecast_date
"
,
ATTR([Close Date]),
ATTR([Line Amount(MINR)]),
[Months Forecast]))

error recieveing while putiing date in columns and values in rows:

Unable to complete action

Error Code: 6605BCF0
Unexpected number of results returned by SCRIPT function. Function expected 104754 values; 104799 values were returned.

I have also deslected the aggregate mesaures from the analysis dropdown. The code is running fine in normal python environment but how to implement the same in the tableau ?

I have performed returning values as string also but how to convert those to numeric row values i am not getting it ?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật