With machine learning and analysis, its always analyzing the data and finding out the statistics. Time series analysis is used when you need to analyze and bring out statistics and predictions using machine learning. Time series are widely used for non-stationary data, like economic, weather, stock price, and retail sales.

Follow these steps:

Select a dataset

Organize and process the data

Plot the values and visualize it

observe the kind of distribution. There are three types of distributions - Trends, Seasonal, noise

Select the best model accordingly. One of the best methods or best algorithms of all times is ARIMA(Autoregressive Integrated Moving Average)

Get the optimal set of parameters that gives the yields the best performance for the selected model.

Finally, fit the ARIMA model using the .fit() and start predicting.

example:

mod = sm.tsa.statespace.SARIMAX(y,
order=(1, 1, 1),
seasonal_order=(1, 1, 0, 12),
enforce_stationarity=False,
enforce_invertibility=False)results = mod.fit()print(results.summary().tables[1])