Update daily.py
Browse files
daily.py
CHANGED
|
@@ -11,7 +11,9 @@ def fetch_daily(symbol):
|
|
| 11 |
try:
|
| 12 |
# --- Fetch historical data ---
|
| 13 |
df = yf.download(symbol + ".NS", period="1y", interval="1d").round(2)
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
if df.empty:
|
| 16 |
return html_card("Error", f"No daily data found for {symbol}")
|
| 17 |
df.reset_index(inplace=True)
|
|
|
|
| 11 |
try:
|
| 12 |
# --- Fetch historical data ---
|
| 13 |
df = yf.download(symbol + ".NS", period="1y", interval="1d").round(2)
|
| 14 |
+
# Reset MultiIndex if exists
|
| 15 |
+
if isinstance(df.columns, pd.MultiIndex):
|
| 16 |
+
df.columns = df.columns.get_level_values(0)
|
| 17 |
if df.empty:
|
| 18 |
return html_card("Error", f"No daily data found for {symbol}")
|
| 19 |
df.reset_index(inplace=True)
|