Forecasting, Data Science, Python, Data Visualization, Machine Learning.
data['Passengers'].rolling(window = 12).mean() # Plot the data and moving average data[['Passengers', 'Moving_Average']].plot() plt.title("Moving Average Forecast") plt.xlabel("Year") plt.ylabel("Passengers") plt.show() C2. Moving Average: R library(forecast) library(ggplot2) # Load the data data