engralimalik commited on
Commit
810b759
·
verified ·
1 Parent(s): e089e4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -27,7 +27,10 @@ def load_data(url):
27
  how="inner"
28
  )
29
 
30
- # Print columns to check if 'school_name' exists
 
 
 
31
  print("Columns in merged data:", merged_data.columns)
32
 
33
  return merged_data
@@ -44,11 +47,12 @@ def plot_map(df, center):
44
 
45
  # Add school locations
46
  for idx, row in df.iterrows():
47
- # Update column names according to the correct ones
 
48
  folium.Marker(
49
  location=[row["latitude"], row["longitude"]],
50
  popup=(
51
- f"School Name: {row['school_name']}<br>" # Assuming 'school_name' is the correct column name
52
  f"Download Speed: {row['download_speed']} Mbps<br>"
53
  f"Upload Speed: {row['upload_speed']} Mbps<br>"
54
  f"Latency: {row['latency']} ms"
 
27
  how="inner"
28
  )
29
 
30
+ # Strip whitespace from all column names
31
+ merged_data.columns = merged_data.columns.str.strip()
32
+
33
+ # Print columns to check the available columns in the data
34
  print("Columns in merged data:", merged_data.columns)
35
 
36
  return merged_data
 
47
 
48
  # Add school locations
49
  for idx, row in df.iterrows():
50
+ school_name = row.get("school_name", "No Name Provided") # Ensure correct column access
51
+
52
  folium.Marker(
53
  location=[row["latitude"], row["longitude"]],
54
  popup=(
55
+ f"School Name: {school_name}<br>"
56
  f"Download Speed: {row['download_speed']} Mbps<br>"
57
  f"Upload Speed: {row['upload_speed']} Mbps<br>"
58
  f"Latency: {row['latency']} ms"