shukdevdatta123 commited on
Commit
c9e1f1e
·
verified ·
1 Parent(s): f62049d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -64
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  import pandas as pd
3
- import plotly.graph_objects as go
4
 
5
  # Load the Excel file
6
  file_path = 'Dhaka Metro Rail Fare 2.XLSX' # Ensure the correct file path
@@ -132,66 +131,3 @@ else:
132
  st.write("No fare data available for the selected origin and destinations.")
133
  else:
134
  st.write("Please select both an origin and at least one destination.")
135
-
136
- st.write("Below is the Map for Dhaka Metro Rail 💶:")
137
-
138
- # Plotting the map using Plotly
139
- fig = go.Figure()
140
-
141
- # Add markers for each unique station
142
- unique_stations = pd.concat([df[['Origin', 'Origin_Lat', 'Origin_Lon']].rename(columns={'Origin': 'Station', 'Origin_Lat': 'Lat', 'Origin_Lon': 'Lon'}),
143
- df[['Destination', 'Destination_Lat', 'Destination_Lon']].rename(columns={'Destination': 'Station', 'Destination_Lat': 'Lat', 'Destination_Lon': 'Lon'})]).drop_duplicates()
144
-
145
- # Add a map marker for each station
146
- for i, row in unique_stations.iterrows():
147
- if row['Station'] == origin:
148
- # Mark the origin as green
149
- fig.add_trace(go.Scattermapbox(
150
- mode="markers+text",
151
- lon=[row['Lon']],
152
- lat=[row['Lat']],
153
- marker={'size': 12, 'color': 'green'},
154
- text=row['Station'],
155
- textposition="top center",
156
- name=row['Station'],
157
- customdata=[row['Station']] # customdata is now a list
158
- ))
159
- elif row['Station'] in destinations:
160
- # Mark the destination as blue
161
- fig.add_trace(go.Scattermapbox(
162
- mode="markers+text",
163
- lon=[row['Lon']],
164
- lat=[row['Lat']],
165
- marker={'size': 12, 'color': 'blue'},
166
- text=row['Station'],
167
- textposition="top center",
168
- name=row['Station'],
169
- customdata=[row['Station']] # customdata is now a list
170
- ))
171
- else:
172
- # Mark all other stations as red
173
- fig.add_trace(go.Scattermapbox(
174
- mode="markers+text",
175
- lon=[row['Lon']],
176
- lat=[row['Lat']],
177
- marker={'size': 12, 'color': 'red'},
178
- text=row['Station'],
179
- textposition="top center",
180
- name=row['Station'],
181
- customdata=[row['Station']] # customdata is now a list
182
- ))
183
-
184
- # Map layout
185
- fig.update_layout(
186
- mapbox=dict(
187
- style="open-street-map",
188
- center=go.layout.mapbox.Center(lat=23.780, lon=90.400), # Center on Dhaka
189
- zoom=11
190
- ),
191
- margin={"r":0,"t":0,"l":0,"b":0},
192
- showlegend=False,
193
- title="Dhaka Metro Rail Location Map"
194
- )
195
-
196
- # Show plot in Streamlit
197
- st.plotly_chart(fig)
 
1
  import streamlit as st
2
  import pandas as pd
 
3
 
4
  # Load the Excel file
5
  file_path = 'Dhaka Metro Rail Fare 2.XLSX' # Ensure the correct file path
 
131
  st.write("No fare data available for the selected origin and destinations.")
132
  else:
133
  st.write("Please select both an origin and at least one destination.")