Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,13 @@ def load_field_sales():
|
|
| 27 |
df['Date'] = pd.to_datetime(df.get("Date", datetime.today()), errors='coerce')
|
| 28 |
df = df.dropna(subset=["Date"])
|
| 29 |
df['DateStr'] = df['Date'].dt.date.astype(str)
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
return df
|
| 32 |
|
| 33 |
def generate_summary(date_str):
|
|
@@ -166,4 +172,4 @@ with gr.Blocks() as app:
|
|
| 166 |
|
| 167 |
login_btn.click(fn=do_login, inputs=[email, password], outputs=[login_ui, main_ui, login_msg])
|
| 168 |
|
| 169 |
-
app.launch()
|
|
|
|
| 27 |
df['Date'] = pd.to_datetime(df.get("Date", datetime.today()), errors='coerce')
|
| 28 |
df = df.dropna(subset=["Date"])
|
| 29 |
df['DateStr'] = df['Date'].dt.date.astype(str)
|
| 30 |
+
|
| 31 |
+
# ✅ Fix: ensure column exists before numeric conversion
|
| 32 |
+
if "Order Value" not in df.columns:
|
| 33 |
+
df["Order Value"] = 0
|
| 34 |
+
else:
|
| 35 |
+
df["Order Value"] = pd.to_numeric(df["Order Value"], errors="coerce").fillna(0)
|
| 36 |
+
|
| 37 |
return df
|
| 38 |
|
| 39 |
def generate_summary(date_str):
|
|
|
|
| 172 |
|
| 173 |
login_btn.click(fn=do_login, inputs=[email, password], outputs=[login_ui, main_ui, login_msg])
|
| 174 |
|
| 175 |
+
app.launch()
|