Jun-19-2019, 08:27 AM
Im converting one chemical notation to another type. My list has like over 6k different names to convert and it takes so long. How can I use multiprocessing? I tried to implement myself, but im a noob. Other code optimisations are welcome too!
I tried to implement multiprocessing myself, but im a noob
I tried to implement multiprocessing myself, but im a noob
def resolve(str_input, representation): import cirpy return cirpy.resolve(str_input, representation) compound_list = [] smiles_list = [] for index, row in df_Verteilung.iterrows(): try: actual_smiles = resolve(row['Compound'], 'smiles') except: actual_smiles = 'Error' print('\r', row['Compound'], actual_smiles, end='') compound_list.append(row['Compound']) smiles_list.append(actual_smiles) df_new = pd.DataFrame({'Compound' : compound_list, 'SmilesCode' : smiles_list}) df_new.to_csv(index=False)