Unverified Commit ae9732af authored by Claude's avatar Claude
Browse files

Convert numpy types to Python native types for JSON serialization

parent 2b6956f3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ def calculate_results(predictions, test_data):
        actual_values = watch_df['actual_demand'].tolist()
        predicted_values = watch_df['predicted_demand'].tolist()

        watch_performance[watch_id] = {
        watch_performance[int(watch_id)] = {  # Convert numpy.int64 to Python int
            'watch_name': watch_df['watch_name'].iloc[0],
            'total_predicted': int(watch_df['predicted_demand'].sum()),
            'total_actual': int(watch_df['actual_demand'].sum()),
@@ -241,7 +241,7 @@ def calculate_results(predictions, test_data):

    # Build monthly comparison structure for templates
    monthly_comparison = []
    for month in df['month'].unique():
    for month in sorted(df['month'].unique()):  # Sort months
        month_df = df[df['month'] == month]

        watches_list = []