awacke1 commited on
Commit
afd4085
1 Parent(s): 4dae6a4

Create trees.py

Browse files
Files changed (1) hide show
  1. trees.py +64 -0
trees.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Trees -----------------------------------------------------------------------------------
3
+ # Trees for use in Claims and ServiceNow/NPS datasets filter and cluster:
4
+ # pip install streamlit-tree-select https://github.com/Schluca/streamlit_tree_select
5
+ # pip install streamlit-condition-tree https://github.com/cedricvlt/streamlit-condition-tree
6
+ # pip install st-ant-tree https://github.com/flucas96/st_ant_tree
7
+ from streamlit_tree_select import tree_select
8
+ from st_ant_tree import st_ant_tree
9
+ import pandas as pd
10
+
11
+ st.write("🐙 Streamlit-tree-select - A simple and elegant checkbox tree for Streamlit.")
12
+ nodes = [
13
+ {"label": "Folder A", "value": "folder_a"},
14
+ {
15
+ "label": "Folder B",
16
+ "value": "folder_b",
17
+ "children": [
18
+ {"label": "Sub-folder A", "value": "sub_a"},
19
+ {"label": "Sub-folder B", "value": "sub_b"},
20
+ {"label": "Sub-folder C", "value": "sub_c"},
21
+ ],
22
+ },
23
+ {
24
+ "label": "Folder C",
25
+ "value": "folder_c",
26
+ "children": [
27
+ {"label": "Sub-folder D", "value": "sub_d"},
28
+ {
29
+ "label": "Sub-folder E",
30
+ "value": "sub_e",
31
+ "children": [
32
+ {"label": "Sub-sub-folder A", "value": "sub_sub_a"},
33
+ {"label": "Sub-sub-folder B", "value": "sub_sub_b"},
34
+ ],
35
+ },
36
+ {"label": "Sub-folder F", "value": "sub_f"},
37
+ ],
38
+ },
39
+ ]
40
+ return_select = tree_select(nodes)
41
+ st.write(return_select)
42
+
43
+ st.write("🐙 st_ant_tree - A simple and elegant checkbox tree for Streamlit.")
44
+ tree_data = [
45
+ {
46
+ "value": "parent 1",
47
+ "title": "Parent 1",
48
+ "children":
49
+ [
50
+ {"value": "child 1",
51
+ "title": "Child 1"},
52
+ {"value": "child 2",
53
+ "title": "Child 2"},
54
+ ]
55
+ },
56
+ {
57
+ "value": "parent 2",
58
+ "title": "Parent 2",
59
+ }
60
+ ]
61
+
62
+
63
+ st_ant_tree(tree_data,allowClear = True)
64
+ # Trees -------------------------------------------------------------------------