Untitled

mail@pastecode.io avatar
unknown
python
a year ago
453 B
3
Indexable
Never

temp = []
cand_dict = {}
for c_p in args.candidates:
    temp.append(pd.read_csv(c_p))

print('Merge Candidates ...')
cand_df = reduce(lambda df1,df2: pd.merge(df1,df2,on='session_type'), temp)
cand_df['labels'] = cand_df['labels_x'] + " " +cand_df['labels_y']
cand_df = cand_df.drop(['labels_x', 'labels_y'], axis=1)
cand_df['labels'] = cand_df['labels'].str.split()
cand_df = cand_df.set_index('session_type')
cand_dict = cand_df.to_dict()['labels']