FeatureGroupSubGroup: nth level subgroups
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- jupyter-notebook, python
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu với cấu trúc FeatureGroupSubGroup được cung cấp và TESTING.html được tạo trong bản tái hiện Jupyter/VS Code; xác minh xem các nhóm con lồng nhau vượt quá một cấp có được biểu diễn và chuyển đổi như mong đợi hay không. Xác định hành vi mong muốn cho cấp thứ n và xác nhận hành vi đó bằng một bản tái hiện bản đồ tối thiểu, bao gồm điều kiện hiển thị điểm đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I am using quite a few levels of recursion to generate a map that has subgroups within subgroups, and im not sure how to fix the issue, or if there is a better method.
To Reproduce
theres alot going on here... the repeated for loops are to keep the buttons ordered by hierarchy.
import folium
from folium import plugins
#####################################################################################
coord = df['Location'].apply(fetch_lat_lon)
df['Lat'] = coord.apply(lambda x: x[0] if isinstance(x, tuple) else None)
df['Long'] = coord.apply(lambda x: x[1] if isinstance(x, tuple) else None)
df['Result'] = (~df['Impounded'].isna().astype(int)).apply(lambda x: _results[x])
df['Interval'] = (datetime.now() - df.index).days
df['Weekday'] = df.index.weekday.map(lambda x: _days[x])
df['Time'] = df.index.hour
df = df[~df['ID'].isna()]
#####################################################################################
m = folium.Map(location=[0, 0], zoom_start=14)
results = {}
intervals = {}
days = {}
times = {}
_results = ['Complete', 'Canceled']
_intervals = [7, 30, 90, 365] ## days before now
_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
_times = range(24)
for result in _results:
results[result] = folium.FeatureGroup(name = result)
m.add_child(results[result])
for result in _results:
for interval in _intervals:
intervals[f'{result}_{interval}'] = plugins.FeatureGroupSubGroup(results[result], f'{interval} Days')
m.add_child(intervals[f'{result}_{interval}'])
for result in _results:
for interval in _intervals: ## days before now
for day in _days:
days[f'{result}_{interval}_{day}'] = plugins.FeatureGroupSubGroup(intervals[f'{result}_{interval}'], day)
m.add_child(days[f'{result}_{interval}_{day}'])
for result in _results:
for interval in _intervals: ## days before now
for day in _days:
for time in _times:
if time < 12:
if time !=0:
times[f'{result}_{interval}_{day}_{time}'] = plugins.FeatureGroupSubGroup(days[f'{result}_{interval}_{day}'], f'{time} AM')
m.add_child(times[f'{result}_{interval}_{day}_{time}'])
else:
times[f'{result}_{interval}_{day}_{time}'] = plugins.FeatureGroupSubGroup(days[f'{result}_{interval}_{day}'], f'{time + 12} AM')
m.add_child(times[f'{result}_{interval}_{day}_{time}'])
elif time > 12:
times[f'{result}_{interval}_{day}_{time}'] = plugins.FeatureGroupSubGroup(days[f'{result}_{interval}_{day}'], f'{time - 12} PM')
m.add_child(times[f'{result}_{interval}_{day}_{time}'])
else:
times[f'{result}_{interval}_{day}_{time}'] = plugins.FeatureGroupSubGroup(days[f'{result}_{interval}_{day}'], f'{time} PM')
m.add_child(times[f'{result}_{interval}_{day}_{time}'])
for result in _results:
for interval in _intervals: ## days before now
for day in _days:
for time in _times:
group = times[f'{result}_{interval}_{day}_{time}']
condition = ((df['Result'] == result) &
(df['Interval'] <= interval) &
(df['Weekday'] == day) &
(df['Time'] == time)
)
_df = df[condition].dropna()
for i in range(len(_df)):
lat = _df['Lat'].iloc[i] - _df['Lat'].mean()
long = _df['Long'].iloc[i] - _df['Long'].mean()
folium.Marker([lat, long]).add_to(group)
folium.LayerControl(collapsed=True).add_to(m)
m.save('TESTING.html')
Expected behavior
When all button conditions are met, points will display,
Environment (please complete the following information):
- chrome
- jupyter notebooks
- vs code
- Ngôn ngữ chính
- Python
- Star
- 7.4k
- Fork
- 2.3k
- Merge trung bình
- 17 giờ 22 phút
- Pull request đã merge (30 ngày)
- 11
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-visualization/folium
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
python-visualization/folium#2092 · 5 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
python-visualization/folium#2278 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
python-visualization/folium#2259 ·
-
Map output from OSM returns blocked tiles, due to defective request or not following referer-policy Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
python-visualization/folium#2236 · 5 bình luận · 1 reaction ·
-
Touch Screen often fails Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
python-visualization/folium#2219 · 2 bình luận ·
Tất cả issue của python-visualization/folium
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·