Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I'm trying to run a python script that will essentially perform time series forecasting on my input data.
What I want is the next 12 predicted values.
I did this in jupyter and power bi both but I'm getting different values for same dates
I'm not sure what random seed needs to be set here.
Code:
import numpy as np
import matplotlib.pyplot as plt
import pypyodbc as pyodbc
import pandas as pd
from statsmodels.tsa.arima_model import ARMA,ARMAResults,ARIMA,ARIMAResults
from statsmodels.graphics.tsaplots import plot_acf,plot_pacf # for determining (p,q) orders
from statsmodels.tsa.holtwinters import ExponentialSmoothing
SERVER_NAME = 'm.its.corp.net'
DATABASE_NAME = 'GDB'
cnxn = pyodbc.connect(Driver='{SQL Server}', Server=SERVER_NAME , database=DATABASE_NAME,
trusted_connection='Yes')
cursor = cnxn.cursor()
sql_query = """
select * from mytable
"""
# With Headers
df = pd.read_sql(sql_query, cnxn,index_col='date',parse_dates=True)
#index col is required to make sure stasmodel on this dataset we need to set index frequency
df.index.freq = 'MS'
method_TESmul12 = ExponentialSmoothing(df['tcv'],trend='mul',seasonal='mul',seasonal_periods=12).fit()
range = pd.date_range('01-02-2022',periods=12,freq='MS')
predictions = method_TESmul12.forecast(12).astype(int)
predictions_range = pd.DataFrame({'Date':range, 'TCV':predictions})
predictions_range
What is wrong?
Dataset has 110 records. 2 records pasted below:
| date | tcv |
| 1/1/2013 | 2011131 |
| 2/1/2013 | 2053142 |
Hi @klehar ,
Could you share a sample file with us? And you can show us a screenshot with the result you want. This will make it easier for us to understand your requirements.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!