Repository navigation
Expand file tree
/
Copy pathDic_P.py
More file actions
77 lines (58 loc) · 1.51 KB
/
Copy pathDic_P.py
File metadata and controls
77 lines (58 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Dic_1={
'a':[10],
'b':[20,30],
'c':[40,10],
'p':[20,30,50]
}
Dic_2={
'p':100,
'q':[40,80],
'a':20,
'b':[80,20],
'd':[48,78]
}
ans_dic={}
for i,v1 in Dic_2.items():
for j,v2 in Dic_1.items():
if(i==j):
if(type(v1)== int and type(v2)== int):
v=[]
v.append(v1)
v.append(v2)
ans_dic[j] = list(set(v))
elif(type(v1)== list and type(v2)== list):
v=[]
v=v1+v2
ans_dic[j] = list(set(v))
elif(type(v1)== int and type(v2)== list):
v=[]
v.append(v1)
v=v+v2
ans_dic[j] = list(set(v))
elif (type(v1) == list and type(v2) == int):
v=[]
v.append(v2)
v = v + v1
ans_dic[j] = list(set(v))
elif(i!=j and j not in Dic_2):
ans_dic[j]=Dic_1[j]
elif(i!=j and i not in Dic_1):
ans_dic[i] = Dic_2[i]
ans_dic = dict(sorted(ans_dic.items()))
print(ans_dic)
# param_dict={
# 'criterion':['gini',"entropy","Hardik"],'max_depth':[3,5,8]
# }
#
# v1 = param_dict['criterion']
# v2=param_dict['max_depth']
# for i in v1:
# for j in v2:
# print(i,j)
# from itertools import product
# param_dict = {
# 'criterion': ['gini', 'entropy', 'Hardik'],
# 'max_depth': [3, 5, 8]
# }
# output = list(product(param_dict['criterion'], param_dict['max_depth']))
# print(output)