Update src/streamlit_app.py
Browse files- src/streamlit_app.py +5 -4
src/streamlit_app.py
CHANGED
|
@@ -44,12 +44,9 @@ def fetch_live_data(start_date, end_date, min_mag):
|
|
| 44 |
origin = event.preferred_origin()
|
| 45 |
magnitude = event.preferred_magnitude()
|
| 46 |
|
| 47 |
-
# --- CORRECTED CODE IS HERE ---
|
| 48 |
# Get location description safely.
|
| 49 |
description = "N/A"
|
| 50 |
-
# First, check if the 'descriptions' attribute exists.
|
| 51 |
if hasattr(event, 'descriptions'):
|
| 52 |
-
# If it exists, then check if it's a non-empty list with text.
|
| 53 |
if event.descriptions and event.descriptions[0].text:
|
| 54 |
description = event.descriptions[0].text
|
| 55 |
|
|
@@ -116,8 +113,12 @@ if search_button:
|
|
| 116 |
fig.update_layout(margin={"r":0,"t":40,"l":0,"b":0}, coloraxis_colorbar_title_text='Depth (km)')
|
| 117 |
st.plotly_chart(fig, use_container_width=True)
|
| 118 |
|
|
|
|
| 119 |
st.subheader("π Detailed Earthquake Data")
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
| 121 |
st.dataframe(
|
| 122 |
display_df.sort_values(by='time', ascending=False),
|
| 123 |
use_container_width=True,
|
|
|
|
| 44 |
origin = event.preferred_origin()
|
| 45 |
magnitude = event.preferred_magnitude()
|
| 46 |
|
|
|
|
| 47 |
# Get location description safely.
|
| 48 |
description = "N/A"
|
|
|
|
| 49 |
if hasattr(event, 'descriptions'):
|
|
|
|
| 50 |
if event.descriptions and event.descriptions[0].text:
|
| 51 |
description = event.descriptions[0].text
|
| 52 |
|
|
|
|
| 113 |
fig.update_layout(margin={"r":0,"t":40,"l":0,"b":0}, coloraxis_colorbar_title_text='Depth (km)')
|
| 114 |
st.plotly_chart(fig, use_container_width=True)
|
| 115 |
|
| 116 |
+
# --- Show Earthquakes in a Table ---
|
| 117 |
st.subheader("π Detailed Earthquake Data")
|
| 118 |
+
|
| 119 |
+
# This line is changed to show latitude and longitude instead of place.
|
| 120 |
+
display_df = df[['time', 'latitude', 'longitude', 'magnitude', 'depth']].copy()
|
| 121 |
+
|
| 122 |
st.dataframe(
|
| 123 |
display_df.sort_values(by='time', ascending=False),
|
| 124 |
use_container_width=True,
|