Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1577,7 +1577,7 @@ def predict_categories(df):
|
|
| 1577 |
# 🔥 Filter: Hanya yang bukan 'Positive'
|
| 1578 |
df = df[df['temuan_kategori'] != 'Positive'].copy() # ✅ Filter non-Positive
|
| 1579 |
|
| 1580 |
-
if '
|
| 1581 |
return pd.DataFrame()
|
| 1582 |
|
| 1583 |
start_month = df['created_at'].min().to_period('M')
|
|
@@ -1586,7 +1586,7 @@ def predict_categories(df):
|
|
| 1586 |
n_months = len(all_months)
|
| 1587 |
|
| 1588 |
results = []
|
| 1589 |
-
for cat, group in df.groupby('
|
| 1590 |
ts_data = (
|
| 1591 |
group.groupby(group['created_at'].dt.to_period('M'))
|
| 1592 |
.size()
|
|
|
|
| 1577 |
# 🔥 Filter: Hanya yang bukan 'Positive'
|
| 1578 |
df = df[df['temuan_kategori'] != 'Positive'].copy() # ✅ Filter non-Positive
|
| 1579 |
|
| 1580 |
+
if 'kategori' not in df.columns or df.empty:
|
| 1581 |
return pd.DataFrame()
|
| 1582 |
|
| 1583 |
start_month = df['created_at'].min().to_period('M')
|
|
|
|
| 1586 |
n_months = len(all_months)
|
| 1587 |
|
| 1588 |
results = []
|
| 1589 |
+
for cat, group in df.groupby('kategori'):
|
| 1590 |
ts_data = (
|
| 1591 |
group.groupby(group['created_at'].dt.to_period('M'))
|
| 1592 |
.size()
|