Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +2 -2
src/streamlit_app.py
CHANGED
|
@@ -23,10 +23,10 @@ def fetch_wnba_data():
|
|
| 23 |
data = response.json()
|
| 24 |
# Extract headers and rows from the first resultSet
|
| 25 |
result_set = data['resultSets'][0]
|
| 26 |
-
|
| 27 |
rows = result_set['rowSet']
|
| 28 |
# Create DataFrame
|
| 29 |
-
df = pd.DataFrame(rows, columns=
|
| 30 |
return df
|
| 31 |
except requests.exceptions.RequestException as e:
|
| 32 |
st.error(f"Error fetching data: {e}")
|
|
|
|
| 23 |
data = response.json()
|
| 24 |
# Extract headers and rows from the first resultSet
|
| 25 |
result_set = data['resultSets'][0]
|
| 26 |
+
api_headers = result_set['headers'] # Use a different name to avoid conflict with global 'headers'
|
| 27 |
rows = result_set['rowSet']
|
| 28 |
# Create DataFrame
|
| 29 |
+
df = pd.DataFrame(rows, columns=api_headers)
|
| 30 |
return df
|
| 31 |
except requests.exceptions.RequestException as e:
|
| 32 |
st.error(f"Error fetching data: {e}")
|