Have the following DF:
parent_path child level table field absent_flag logic
2 dummy{}.map{} amap 3 table_input1 MAP_A 1
5 dummy{}.array[] b_array 3 table_input2 ARRAY_B 0
4 dummy{}.array[] a_array 3 table_input1 ARRAY_A NA FROM ARRAY_TABLE
1 dummy{} B 2 table_input BBB 0
0 dummy{} A 2 table_input AAA 0 FROM MAIN_TABLE
I want to extract the logic by the parent_path ,
note, parent_path can have multiple rows but only one logic will get per parent_path
i.e: dummy{}.array[]
I try:
partnt_path ="dummy{}.array[]"
logic_from_df = df_origin.loc[df_origin['parent_path'] == partnt_path,'logic' ]
logic_from_origin.dropna()
print("type logic: ",type(logic_from_origin),"returns:<",logic_from_origin.astype(str),">")
>>>
type logic: <class 'pandas.core.series.Series'> returns:< 5
4 FROM ARRAY_TABLE
I guess i could apply some cleanup to the string but is there more elegant way to extract
"FROM_ARRAY_TABLE"
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…