Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -243,8 +243,7 @@ def create_injuries_fatalities_chart(crash_data):
|
|
| 243 |
|
| 244 |
return line_chart
|
| 245 |
|
| 246 |
-
|
| 247 |
-
# Filter by weather condition if provided
|
| 248 |
if weather and weather != 'All Conditions':
|
| 249 |
df = df[df['Weather'] == weather]
|
| 250 |
|
|
@@ -274,8 +273,8 @@ def main():
|
|
| 274 |
# Load data
|
| 275 |
df = load_and_preprocess_data('1.08_Crash_Data_Report_(detail).csv')
|
| 276 |
|
| 277 |
-
|
| 278 |
-
|
| 279 |
|
| 280 |
# Create tabs for different visualizations
|
| 281 |
tab1, tab2, tab3 = st.tabs(["Crash Statistics", "Crash Map", "Crash Trend"])
|
|
|
|
| 243 |
|
| 244 |
return line_chart
|
| 245 |
|
| 246 |
+
def create_crash_trend_chart(df, weather=None):
|
|
|
|
| 247 |
if weather and weather != 'All Conditions':
|
| 248 |
df = df[df['Weather'] == weather]
|
| 249 |
|
|
|
|
| 273 |
# Load data
|
| 274 |
df = load_and_preprocess_data('1.08_Crash_Data_Report_(detail).csv')
|
| 275 |
|
| 276 |
+
if 'Weather' not in df.columns:
|
| 277 |
+
df['Weather'] = 'Unknown'
|
| 278 |
|
| 279 |
# Create tabs for different visualizations
|
| 280 |
tab1, tab2, tab3 = st.tabs(["Crash Statistics", "Crash Map", "Crash Trend"])
|