import folium from folium import DivIcon from folium.plugins import Draw def create_map(dataframe, recommendations): m = folium.Map( location=[35.1796, 129.0406], zoom_start=12, tiles='CartoDB positron' ) for idx, row in dataframe.iterrows(): cell_id = row['enbid_pci'] recommended_cell_state = recommendations.get(cell_id, 'UNKNOWN') if recommended_cell_state == 'ON': color = '#01DFA5' elif recommended_cell_state == 'OFF': color = '#FA5858' else: color = '#ccc' custom_icon = DivIcon( html=f""" """, icon_size=(20, 20), icon_anchor=(10, 10) ) marker = folium.Marker( location=(row['ru_svc_lat_val'], row['ru_svc_lng_val']), icon=custom_icon, tooltip=f'{cell_id} - {recommended_cell_state}' ) marker.add_to(m) return m