--------------------------------------------------------------------------
TypeError Traceback (most recent call last)
e:\Soliman's lab\git project\pyMolNetEnhancer-master\Example_notebooks\ChemicalClasses_2_Network_FeatureBased.ipynb Cell 11 line 1
----> 1 out = unique_smiles(matches)
File
c:\Users\shach\AppData\Local\Programs\Python\Python39\lib\site-packages\pyMolNetEnhancer\molnetenhancer.py:157, in unique_smiles
(matches)
155 matches[index] = matches[index].rename(columns = {'Scan':'cluster.index'})
156 if '#Scan#' in matches[index].columns:
--> 157 matches[index] = matches[index].groupby('#Scan#', as_index=False).agg(lambda x: ','.join(set(x.dropna())))
158 matches[index] = matches[index].rename(columns = {'#Scan#':'cluster.index'})
160 comb = reduce(lambda left,right: pd.merge(left,right,on='cluster.index', how = "outer"), matches)
File
c:\Users\shach\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\groupby\generic.py:1492, in DataFrameGroupBy.aggregate
(self, func, engine, engine_kwargs, *args, **kwargs)
1490 gba = GroupByApply(self, [func], args=(), kwargs={})
1491 try:
-> 1492 result = gba.agg()
1494 except ValueError as err:
1495 if "No objects to concatenate" not in str(err):
File
c:\Users\shach\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\apply.py:178, in Apply.agg
(self)
175 return self.agg_dict_like()
176 elif is_list_like(func):
177 # we require a list, but not a 'str'
--> 178 return self.agg_list_like()
180 if callable(func):
...
--> 157 matches[index] = matches[index].groupby('#Scan#', as_index=False).agg(lambda x: ','.join(set(x.dropna())))
158 matches[index] = matches[index].rename(columns = {'#Scan#':'cluster.index'})
160 comb = reduce(lambda left,right: pd.merge(left,right,on='cluster.index', how = "outer"), matches)
TypeError: sequence item 0: expected str instance, float found