Arafath10 commited on
Commit
5a95277
·
verified ·
1 Parent(s): 3ab676b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -7
main.py CHANGED
@@ -158,9 +158,9 @@ def forecast(monthly_sales):
158
 
159
  return combined_sales, original_forecasted_value, rounded_value
160
 
161
- def process_product(product_name, data,sub_sku):
162
  full_trend = ""
163
-
164
  try:
165
  # Get today's date
166
  today = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
@@ -211,13 +211,11 @@ async def generate_product_count_prediction(b_id: int):
211
 
212
  if message == "done":
213
 
214
- # Group the DataFrame by both 'product_name' and 'sub_sku'
215
- grouped_df = data.groupby(['product_name', 'sub_sku'])
216
-
217
  results = []
218
  with ThreadPoolExecutor() as executor:
219
- # Submit jobs to the executor, passing both product_name and sub_sku
220
- futures = [executor.submit(process_product, product_name, sub_sku, product_df.copy()) for (product_name, sub_sku), product_df in grouped_df]
221
  for future in as_completed(futures):
222
  results.append(future.result())
223
 
 
158
 
159
  return combined_sales, original_forecasted_value, rounded_value
160
 
161
+ def process_product(product_name, data):
162
  full_trend = ""
163
+ print(data)
164
  try:
165
  # Get today's date
166
  today = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
 
211
 
212
  if message == "done":
213
 
214
+ grouped_df = data.groupby('product_name')
215
+
 
216
  results = []
217
  with ThreadPoolExecutor() as executor:
218
+ futures = [executor.submit(process_product, product_name, product_df.copy()) for product_name, product_df in grouped_df]
 
219
  for future in as_completed(futures):
220
  results.append(future.result())
221