Spaces:
Sleeping
Sleeping
Commit ·
b17ff40
1
Parent(s): db53222
Adding fix
Browse files- src/utils/data_processor.py +12 -2
src/utils/data_processor.py
CHANGED
|
@@ -567,7 +567,12 @@ class AspectAnalytics:
|
|
| 567 |
'priority_score': round(metrics['priority_score'], 2)
|
| 568 |
})
|
| 569 |
|
| 570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
|
| 572 |
# Create Strength Anchors DataFrame (top positive aspects)
|
| 573 |
strength_data = []
|
|
@@ -581,7 +586,12 @@ class AspectAnalytics:
|
|
| 581 |
'strength_score': round(metrics['strength_score'], 2)
|
| 582 |
})
|
| 583 |
|
| 584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
|
| 586 |
return areas_of_improvement, strength_anchors
|
| 587 |
|
|
|
|
| 567 |
'priority_score': round(metrics['priority_score'], 2)
|
| 568 |
})
|
| 569 |
|
| 570 |
+
# Handle empty DataFrame case
|
| 571 |
+
if improvement_data:
|
| 572 |
+
areas_of_improvement = pd.DataFrame(improvement_data).sort_values('priority_score', ascending=False)
|
| 573 |
+
else:
|
| 574 |
+
# Return empty DataFrame with correct columns
|
| 575 |
+
areas_of_improvement = pd.DataFrame(columns=['aspect', 'negativity_pct', 'intent_severity', 'frequency', 'priority_score'])
|
| 576 |
|
| 577 |
# Create Strength Anchors DataFrame (top positive aspects)
|
| 578 |
strength_data = []
|
|
|
|
| 586 |
'strength_score': round(metrics['strength_score'], 2)
|
| 587 |
})
|
| 588 |
|
| 589 |
+
# Handle empty DataFrame case
|
| 590 |
+
if strength_data:
|
| 591 |
+
strength_anchors = pd.DataFrame(strength_data).sort_values('strength_score', ascending=False)
|
| 592 |
+
else:
|
| 593 |
+
# Return empty DataFrame with correct columns
|
| 594 |
+
strength_anchors = pd.DataFrame(columns=['aspect', 'positivity_pct', 'intent_type', 'frequency', 'strength_score'])
|
| 595 |
|
| 596 |
return areas_of_improvement, strength_anchors
|
| 597 |
|