There 1 to 100 T-shirts in the showroom. predict the next month on date 01/12/2023 sale based on the last three month sale history. Please write a code in python

 Here's an example code using Python:

 

import numpy as np

# Sample sales data for the last three months
sales_history = [50, 60, 70]

# Calculate the moving average
moving_average = np.mean(sales_history)

# Predict next month's sale
predicted_sale = int(moving_average)

print(f"Based on the last three months' sales history, the predicted sale for next month is: {predicted_sale} T-shirts")

This code calculates the moving average of the sales data for the last three months and then predicts next month's sale based on that average. Keep in mind that this is a very basic prediction model, and more advanced models may be required depending on the complexity of your sales data.

Feel free to adjust the sales_history list with your actual sales data before running the code. Additionally, you can explore more sophisticated time series forecasting methods if needed, such as ARIMA or machine learning models.

 

Comments

Popular posts from this blog

I am from mechanical background.. how I can start with python? Tell me career opportunities also .

Root Finding in Python: Solving and Visualizing Equations with SciPy

Here's a step-by-step guide to help you install Visual Studio Code (VSCode) for Python on Windows