멀티프로세싱
def mappint_m1(_p):
print('mappint_m1 --')
cw = WeatherAPI()
df_xy_rank[0:2].apply(cw.get_xy, axis=1)
print(cw.add3_arr)
_p.put(cw.add3_arr)
def mappint_m2(_p):
print('mappint_m2 --')
cw = WeatherAPI()
df_xy_rank[2:4].apply(cw.get_xy, axis=1)
print(cw.add3_arr)
_p.put(cw.add3_arr)
q1 = Queue()
q2 = Queue()
p1 = Process(target=mappint_m1, args=(q1,))
p1.start()
add3_arr.append(q1.get())
p2 = Process(target=mappint_m2, args=(q2,))
p2.start()
add3_arr.append(q2.get())
p1.join()
p2.join()
동적변수
if cate in code_dict.keys():
value = str(i['fcstValue'])
g_name = code_dict[cate]+'_arr'
exec(f"self.{g_name}.append(value)")